[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash aliases erroneously expanded in 'case' patterns in some conditi
Re: Bash aliases erroneously expanded in 'case' patterns in some conditions
Sat, 25 Mar 2017 16:51:56 -0400
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 3/24/17 11:34 PM, Torka Noda wrote:
> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
> When sourcing a script (rather than executing it), if
> the "in" keyword of a case construct is on its own line
> (rather than on the first line of the construct with
> "case", or on the same line as the first pattern), then
> the pattern is expanded as an alias, if it exists.
This actually happens any time alias expansion is enabled, so sourcing
this file from a script would not ordinarily trigger it, whereas sourcing
it from an interactive shell, as I assume you did, will.
Whether you source this from a script or put it directly into a script you
execute, running `shopt -s expand_aliases' will trigger it.
No matter how it's triggered, the code that implements Posix grammar rule 6
doesn't get executed at the right time, though the token IN still gets
recognized, so the alias expansion is performed.
This will be fixed in the next release of bash.
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/