help-bash
[
Top
][
All Lists
]
Advanced
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
[Help-bash] inconsistency in expansions
From
:
Bill Gradwohl
Subject
:
[Help-bash] inconsistency in expansions
Date
:
Sun, 6 May 2012 13:24:09 -0600
set -- "The cat " "ate the " "canary"
echo $#
x=$#
declare string
string="${*%${$#}}"
echo $string
string="${*%${$x}}"
echo $string
string="${*%${3}}"
echo $string
Produces:
address@hidden ycc# ./tst
3
The cat ate the canary
./tst: line 7: ${$x}: bad substitution
The cat ate the canary
The cat ate the
I expected all of them to work.
Why does bad substitution only occur for $x and not for $#?
$# version is ignored - doesn't work and doesn't produce an error message.
Aren't expansions done from the inside out?
--
Bill Gradwohl
reply via email to
[Prev in Thread]
Current Thread
[
Next in Thread
]
[Help-bash] inconsistency in expansions
,
Bill Gradwohl
<=
Re: [Help-bash] inconsistency in expansions
,
Dan Douglas
,
2012/05/06
Re: [Help-bash] inconsistency in expansions
,
John Kearney
,
2012/05/07
Re: [Help-bash] inconsistency in expansions
,
Pierre Gaston
,
2012/05/07
Re: [Help-bash] inconsistency in expansions
,
Dan Douglas
,
2012/05/07
Re: [Help-bash] inconsistency in expansions
,
John Kearney
,
2012/05/07
Re: [Help-bash] inconsistency in expansions
,
Bill Gradwohl
,
2012/05/07
Re: [Help-bash] inconsistency in expansions
,
Bill Gradwohl
,
2012/05/07
Re: [Help-bash] inconsistency in expansions
,
Greg Wooledge
,
2012/05/07
Re: [Help-bash] inconsistency in expansions
,
John Kearney
,
2012/05/07
Re: [Help-bash] inconsistency in expansions
,
Chet Ramey
,
2012/05/07
Prev by Date:
Re: [Help-bash] indirection for arrays
Next by Date:
Re: [Help-bash] inconsistency in expansions
Previous by thread:
[Help-bash] indirection for arrays
Next by thread:
Re: [Help-bash] inconsistency in expansions
Index(es):
Date
Thread