bug-bash
[Top][All Lists]
Advanced

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

Re: Brace expansion fail compilation


From: Pierre Gaston
Subject: Re: Brace expansion fail compilation
Date: Wed, 26 Apr 2017 13:17:56 +0300

On Wed, Apr 26, 2017 at 1:13 PM, Florian Mayer <address@hidden> 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


reply via email to

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