[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
histexpand in shebang-less script
From: |
Grisha Levit |
Subject: |
histexpand in shebang-less script |
Date: |
Fri, 24 Jul 2020 19:44:08 -0400 |
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
--
- histexpand in shebang-less script,
Grisha Levit <=