Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16616
| From | Grisha Levit <grishalevit@gmail.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | histexpand in shebang-less script |
| Date | 2020-07-24 19:44 -0400 |
| Message-ID | <mailman.519.1595634263.24492.bug-bash@gnu.org> (permalink) |
| References | <CAMu=Brp0zxz6R9pszEizu-3=HUpYOUOmXvs5h+9o3WcL1UGEDA@mail.gmail.com> |
The value of `histexpand' is not reset when executing a shebang-less script. (Admittedly, this is unlikely to matter since the value of `history' *is* properly reset.) $ cat > /tmp/test1.sh <<"EOF" #!/usr/bin/env bash echo $- EOF $ cat > /tmp/test2.sh <<"EOF" echo $- EOF $ chmod +x /tmp/test1.sh /tmp/test2.sh $ set -H $ /tmp/test1.sh hB $ /tmp/test2.sh hBH Since reset_shell_flags is only called in this circumstance, it seems that turning off history expansion should be the right thing to do in that function. --- flags.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/flags.c b/flags.c index 7e301f77..187c2e98 100644 --- a/flags.c +++ b/flags.c @@ -366,7 +366,3 @@ reset_shell_flags () #if defined (BANG_HISTORY) -# if defined (STRICT_POSIX) - history_expansion = 0; -# else - history_expansion = 1; -# endif /* STRICT_POSIX */ + histexp_flag = 0; #endif --
Back to gnu.bash.bug | Previous | Next | Find similar
histexpand in shebang-less script Grisha Levit <grishalevit@gmail.com> - 2020-07-24 19:44 -0400
csiph-web