Am 07.05.2012 14:55, schrieb Bill Gradwohl:
On Mon, May 7, 2012 at 6:29 AM, Greg
Wooledge <address@hidden>
wrote:
On Sun, May 06, 2012 at 01:24:09PM -0600, Bill Gradwohl wrote:
> set -- "The cat " "ate the " "canary"
> echo $#
> x=$#
> declare string
> string="${*%${$#}}"
What the bloody hell is that supposed to DO?
Sorry - I thought it was obvious. I want all of the passed
parameters in one string, except the last passed parameter for
how ever many parameters there are.
all you need is
string="${*:1:$#-1}"
> I expected all of them to work.
What is "work"?
The last example works. I expected the rest to also work as
$x evaluates to 3 and $# evaluates to 3.
I got 3 different results, when I was expecting 1 result. I
want to understand how each is different, and WHY I got the
results I got.
--
Bill Gradwohl
|