[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Brace expansion fail compilation
From: |
Florian Mayer |
Subject: |
Re: Brace expansion fail compilation |
Date: |
Wed, 26 Apr 2017 12:25:18 +0200 |
wow..., ok thanks for the quick reply
> On 26 Apr 2017, at 12:17, Pierre Gaston <pierre.gaston@gmail.com> wrote:
>
>
>
>> On Wed, Apr 26, 2017 at 1:13 PM, Florian Mayer <mayerflorian@me.com> wrote:
>> $ echo $BASH_VERSION
>> 4.4.12(1)-release
>> $ echo $BASH_VERSION{nobraceexpansion}
>> 4.4.12(1)-release{nobraceexpansion}
>> $ echo ${BASH_VERSION}{brace,expansion}
>> 4.4.12(1)-releasebrace 4.4.12(1)-releaseexpansion
>> $ echo $BASH_VERSION{brace,expansion}
>> => no output. Unexpected
>> $ echo $BASH_VERSIONfoo
>> => no output as expected
>>
>> Why does
>> $ echo $BASH_VERSION{brace,expansion}
>> produce no output?
>>
> it's because brace expansion occurs before parameter expansion
> so first
> echo $BASH_VERSION{brace,expansion}
> is expanded to
> echo $BASH_VERSIONbrace $BASH_VERSIONexpansion
> and these 2 variables are not set.
>
> you can verify with:
> $ BASH_VERSIONbrace=foo BASH_VERSIONexpansion=bar; echo
> $BASH_VERSION{brace,expansion}
> foo bar
>
>
>