On Wednesday, August 14, 2024, Steffen Nurpmeso <stef...@sdaoden.eu> wrote:
>
>   one() { echo "$# 1<$1>"; }
>   two() { one "$@"; }
>   twox() { one "$@$@"; }
>   two
>   two x
>   twox
>   twox x



>   $ dash shbug.sh
>   0 1<>
>   1 1<x>
>   1 1<>
>   1 1<xx>



>   #?0|kent:tmp$ bash shbug.sh
>   0 1<>
>   1 1<x>
>   0 1<>
>   1 1<xx>
>

FWIW, POSIX doesn't pick sides on this; XCU 2.5.2 <
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_05_02>
says:

If there are no positional parameters, the expansion of '@' shall generate
zero fields, even when '@' is within double-quotes; however, if the
expansion is embedded within a word which contains one or more other parts
that expand to a quoted null string, these null string(s) shall still
produce an empty field, except that if the other parts are all within the
same double-quotes as the '@', it is unspecified whether the result is zero
fields or one empty field.


-- 
Oğuz

Reply via email to