Hi,

http://pubs.opengroup.org/onlinepubs/9699919799.2016edition/utilities/sh.html
the "sh" utility

has:

>      The following operands shall be supported:
> 
>      -
>            A single <hyphen-minus> shall be treated as the
>            first operand and then ignored. If both '-' and
>            "--" are given as arguments, or if other operands
>            precede the single <hyphen-minus>, the results are
>            undefined.

That doesn't make sense to me.

That seems to imply that in

sh -c 'echo "$*"' sh - + /

Or

sh ./script + - /

That "-" is treated as the first operand?!?

Even if we have to understand it as:

<< "-" as a standalone argument shall be treated as the end
of options and ignored like for "--">>

The second part doesn't make sense to me. It would imply that
the result is undefined for:

sh ./script -f - file.txt

(2 operands before "-")

sh -u - "$script" -x -- *.txt
sh -e -- "$script" -f -

Both "-" and "--" given as argument.

The whole point of "-" and "--" is to ensure what follows is
safely treated as a list of operands. It defeats the purpose if
one can't use "--" or "-" in that list of operands.

Am I missing something?

-- 
Stephane

Reply via email to