[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: excess braces ignored: bug or feature ?
From: |
Bob Proulx |
Subject: |
Re: excess braces ignored: bug or feature ? |
Date: |
Fri, 17 Feb 2012 13:27:52 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Greg Wooledge wrote:
> Mike Frysinger wrote:
> > can't tell if this is a bug or a feature.
> >
> > FOO= BAR=bar
> > : ${FOO:=${BAR}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
> > echo $FOO
> >
> > i'd expect an error, or FOO to contain those excess braces. instead, FOO
> > is
> > just "bar".
>
> imadev:~$ : ${FOO:=BAR}qqqqqqqqqqqq
> imadev:~$ echo "$FOO"
> BAR
>
> It looks OK to me. You've got an argument word which happens to contain
> a substitution-with-side-effects as part of it.
Or slightly differently expressed it is this too:
$ echo ${FOO:=BAR}qqqqqqqqqqqq
BARqqqqqqqqqqqq
$ echo ${FOO:=BAR}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
BAR}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
$ echo ${FOO:=${BAR}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
Seems reasonable to me. In that context the bracket isn't special in
any way and is just another character in the string. Just like this:
$ echo }}}}
}}}}
Bob
Re: excess braces ignored: bug or feature ?, Chet Ramey, 2012/02/19