[Top][All Lists]

[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:11:48 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

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

> 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

View John
          Kearney's profile on LinkedIn John Kearney

reply via email to

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