help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] inconsistency in expansions


From: John Kearney
Subject: Re: [Help-bash] inconsistency in expansions
Date: Mon, 07 May 2012 15:32:03 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

Am 07.05.2012 15:12, schrieb Greg Wooledge:
On Mon, May 07, 2012 at 07:09:15AM -0600, Bill Gradwohl wrote:
${$x} isn't a valid expansion, so it throws an error, the pattern isn't
matched, and nothing happens.
I see it produces an error, but I still don't see why. If $x expands to 3
why don't I get ${3} and then the expansion of ${3}? Why is it illegal?
What bash rule makes it so?
The definition of parameter expansion:

$parameter
${parameter[operator]}

$x is not a valid parameter.  x is a valid parameter.  3 is a valid
parameter.  $x is not.  Therefore you cannot write ${$x}.

You just got me to realize that these work
both
${!x}
and
${!#}



--
View
          John Kearney's profile on LinkedIn John
          Kearney

reply via email to

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