[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: error parsing file glob when importing function from environment
From: |
Chet Ramey |
Subject: |
Re: error parsing file glob when importing function from environment |
Date: |
Fri, 27 Feb 2015 08:38:58 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
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, adyer@ptc.com 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 chet@case.edu http://cnswww.cns.cwru.edu/~chet/