Question on $@ vs $@$@
Steffen Nurpmeso
steffen at sdaoden.eu
Wed Aug 14 20:05:34 UTC 2024
Hello.
I only respond to this to reduce the noise.
Chet Ramey wrote in
<1bba673e-5ab9-4263-9d88-124854793b4b at 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)
More information about the busybox
mailing list