bug-bash
[Top][All Lists]
Advanced

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

Re: Brace Expansion doesn't handle whitespace gracefully


From: Chet Ramey
Subject: Re: Brace Expansion doesn't handle whitespace gracefully
Date: Tue, 30 Aug 2016 17:05:44 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 8/30/16 2:43 PM, Wesley Hirsch wrote:

>         My guess is that is caused by the fact that initial
> wordsplitting separates
>         the components before brace expansion can get to them, but this is
>         unintuitive, and either the behavior should change or the 
> documentation
>         should call out that you can't do this.

Close.  Brace expansions are not individual shell syntactic elements (that
is, they are not parsed as a single word).  Brace expansions containing
whitespace are treated as separate words by the lexical analyzer.  The
brace expansion code sees, and attempts to individually expand, four
separate words in your example.

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://cnswww.cns.cwru.edu/~chet/



reply via email to

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