bug-bash
[Top][All Lists]
Advanced

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

Re: Question on $@ vs $@$@


From: Steffen Nurpmeso
Subject: Re: Question on $@ vs $@$@
Date: Wed, 14 Aug 2024 22:05:34 +0200
User-agent: s-nail v14.9.25-599-g5c75a327b2

Hello.

I only respond to this to reduce the noise.

Chet Ramey wrote in
 <1bba673e-5ab9-4263-9d88-124854793b4b@case.edu>:
 |On 8/13/24 8:45 PM, Steffen Nurpmeso wrote:
 |> I include bug-bash even though i think bash is correct, but there
 |> lots of people of expertise are listening, so, thus.
 |> Sorry for cross-posting, nonetheless.
 |> Given this snippet (twox() without argument it is)
 |> 
 |>    one() { echo "$# 1<$1>"; }
 |>    two() { one "$@"; }
 |>    twox() { one "$@$@"; }
 |>    two
 |>    two x
 |>    twox
 |>    twox x
 ...
 |When, as in this case, the result would be split if the double quotes
 |weren't there, $@ within double quotes expands to nothing if there are
 |no positional parameters, no matter how many times it appears.

As was shown there is standard wording which makes this case
explicitly unspecified.  Thanks for pointing this out.  I should
have reread the standard first (that particular wording is hard to
grasp for me).
And yes, i think bash is doing the more sensitive thing here, as
the standard says that "@" shall expand to zero, and zero plus
zero makes zero for me.

Thank you, and sorry for the noise.

Ciao,

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



reply via email to

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