bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shopt ignored in process substitutions


From: Chet Ramey
Subject: Re: Shopt ignored in process substitutions
Date: Wed, 28 Jan 2015 08:45:04 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 1/28/15 4:48 AM, Nikolai Kondrashov wrote:
> Hi everyone,
> 
> I've noticed a change in Bash 4.3.30 and 4.3.33, compared to 4.2.53, which
> looks like a bug.

It's not.

> With the older versions this:
> 
>     bash -c 'cat < <(shopt -s extglob'$'\n''echo !(*))'
> 
> would output this:
> 
>     !(*)
> 
> which is fine.
> 
> However, the newer versions would fail like this:
> 
>     bash: command substitution: line 2: syntax error near unexpected token `('
>     bash: command substitution: line 2: `echo !(*))'
> 
> Is this intended? If not, can this be fixed?

As of bash-4.3.23, process substitutions are parsed by the parent shell in
order to correctly find the closing `)', just like command substitutions.
Read the thread beginning at

http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00056.html

for a discussion of the problem.

Since the construct is parsed before being executed, extglob is not
enabled during parsing.  This is a problem similar to enabling extglob
in shell functions.

Chet
-- 
``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/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]