Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug with assignments in some commands
To expand on what PWS wrote:
echo "$((x++)), x is $x" | cat
echo "${x::=2}, x is $x" | cat
Those are both obvious subshells, forked to the left. POSIX actually
says that ALL commands in a pipeline are to be subshells, but allows
exceptions.
cat <<<"$((x++))"
cat <<END
$((x++)), x is $x
END
Those should also be obvious, "cat" is an external command so the
entire thing (including the here-document input) is forked off.
<<<"$((x++)), x is $x"
<<END
$((x++)), x is $x
END
Those are less obvious, but they are equivalent to
$NULLCMD <<<"$((x++)), x is $x"
$NULLCMD <<END
$((x++)), x is $x
END
which are again forked as separate processes.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author