From: Marc Chantreux <mc@unistra.fr>
To: dash@vger.kernel.org, busybox@busybox.net, bug-bash@gnu.org,
Steffen Nurpmeso <steffen@sdaoden.eu>
Subject: Re: Question on $@ vs $@$@
Date: Thu, 15 Aug 2024 09:14:02 +0200 [thread overview]
Message-ID: <Zr2qunm18NGdJ_Bx@prometheus> (raw)
In-Reply-To: <Zryv5acNkrImASKj@wooledge.org>
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
next prev parent reply other threads:[~2024-08-15 7:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 0:45 Question on $@ vs $@$@ Steffen Nurpmeso
2024-08-14 2:17 ` Greg Wooledge
2024-08-14 9:04 ` Marc Chantreux
2024-08-14 13:23 ` Greg Wooledge
2024-08-14 14:51 ` Robert Elz
2024-08-15 7:14 ` Marc Chantreux [this message]
2024-08-14 14:20 ` Robert Elz
2024-08-14 14:58 ` Oğuz
2024-08-14 15:28 ` Greg Wooledge
2024-08-14 15:57 ` Chet Ramey
2024-08-14 20:05 ` Steffen Nurpmeso
2024-08-15 18:48 ` Steffen Nurpmeso
2024-08-15 21:33 ` Steffen Nurpmeso
[not found] ` <CAALKErGQcz=LS=xC544fXf9OywVmU32s1R-wSKzVTiavQTHZ6Q@mail.gmail.com>
2024-08-27 0:28 ` Steffen Nurpmeso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zr2qunm18NGdJ_Bx@prometheus \
--to=mc@unistra.fr \
--cc=bug-bash@gnu.org \
--cc=busybox@busybox.net \
--cc=dash@vger.kernel.org \
--cc=steffen@sdaoden.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox