Date: Thu, 23 May 2024 05:57:05 +0300
From: =?UTF-8?B?T8SfdXo=?= <[email protected]>
Message-ID:
<cah7i3lowwzcnp-pcqamw6+ggkdoa6zi41p2pi98fpzhxyfp...@mail.gmail.com>
| On Thu, May 23, 2024 at 2:49 AM Steffen Nurpmeso <[email protected]> wrote:
| > Only to note that this is not portable.
| Nor will NetBSD sh.
That's right, and this is expressly unspecified in POSIX.
But I think this aspect is missing the point of the OP's message,
which might have been better illustrated without stepping into
unspecified behaviour using
$SHELL -x -c 'x=1 y=2'
I can see the point, this is two var-assigns on a single (empty)
command, not two commands, which
$SHELL -x -c 'x=1 ; y=2'
would be (and which is fully specified to be each fully executed
before the next is started, avoiding the other issue).
As a comparison consider
$SHELL -x -c 'x=1 y=2 :'
which the first above is almost equivalent to (the difference is
the exit status should there be any command substitutions involved).
However, I don't really see that this should matter all that much.
(-x output is not specified anywhere, just that it happens).
kre