[Top][All Lists]

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

Re: [Help-bash] inconsistency in expansions

From: Bill Gradwohl
Subject: Re: [Help-bash] inconsistency in expansions
Date: Mon, 7 May 2012 06:55:44 -0600

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.
> 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

reply via email to

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