[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on $@ vs $@$@
From: |
Marc Chantreux |
Subject: |
Re: Question on $@ vs $@$@ |
Date: |
Thu, 15 Aug 2024 09:14:02 +0200 |
On Wed, Aug 14, 2024 at 09:23:49AM -0400, Greg Wooledge wrote:
> The most obvious would be to treat "$@$@" as if it were "$@" "$@",
> generating exactly two words for each positional parameter.
>
> <A> <B> <C> <A> <B> <C>
Thanks for this. My two cents:
if I want "$@" "$@", i write it litterally. "$@$@" kinda tricks me
in that case because it's not consistent with the other cases I already
used ("$foo$@", for exemple).
> If there are *two* instances of $@ within the same word, then the final
> parameter of the *first* $@ is supposed to be "joined with the last
> part of the original word". But the "last part of the original word"
> is another list expansion, not a string! What does it even mean for
> the final parameter to be "joined" with a list expansion?
good point: that's ambigious. zsh has the explicit twigil $^ (inspired
by the rc operator, I think) to make the distribution explicit (like a
brace expansion) but as dash lack both those features, I still think
my proposal both more consistent and doing something different.
> So, neither of these results would shock me:
> <A> <B> <CA B C> (treat it like "$@$*")
> <A B CA> <B> <C> (treat it like "$*$@")
well. "$@" "$@", $@$* and $*$@ are clear syntaxes that proves an intention
so "$@$@" should be another one related to the fact that something is
joined at the boundary. and to me "something" means "anything left between"
(possibly empty).
so: set A B
"$@ x $@" => "A" "B x A" "B"
"$@$@" => "A" "BA" "B"
> I'd still love to know what the script's intent is.
I my guess would be based on "nothing but what the other syntaxes
provides more expicitly".
regards
--
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79
Re: Question on $@ vs $@$@, Oğuz, 2024/08/14
Re: Question on $@ vs $@$@, Robert Elz, 2024/08/14
Re: Question on $@ vs $@$@, Chet Ramey, 2024/08/14