On 2/26/15 5:24 PM, Stephane Chazelas wrote:
> 2015-02-26 16:35:14 -0500, Chet Ramey:
>> On 2/26/15 2:37 PM, [email protected] wrote:
>>
>>> Bash Version: 4.2
>>> Patch Level: 47
>>> Release Status: release
>>>
>>> Description:
>>> A bash function containing the syntax "files=( !(PAT) )" fails to parse
>>> in a sub-shell when imported from the environment (to which it was
>>> exported
>>> by the parent shell).
>>
>> The extended globbing syntax is accepted by the parser when the `extglob'
>> shell option is enabled. If you (or some agent) export a function using
>> that syntax, you will need to make sure that the extglob option is enabled
>> when it's parsed by the subshell.
> [...]
>
> That doesn't seem to work when exporting the option with
> BASHOPTS though.
The shell doesn't set options inherited via SHELLOPTS or BASHOPTS until
after the environment is read. That works to avoid side effects, unless,
of course, you want them.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/