[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: histexpand in shebang-less script
From: |
Chet Ramey |
Subject: |
Re: histexpand in shebang-less script |
Date: |
Mon, 27 Jul 2020 15:22:44 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 7/24/20 7:44 PM, Grisha Levit wrote:
> 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.
Thanks for the report and fix.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/