On 2019-08-14 05:01, Harald Dunkel wrote:
Hi folks,

I just learned by accident that

        var="-n"
        /bin/echo -- $var

actually prints

        -- -n

Shouldn't it be just

        -n
?

According to POSIX, echo doesn't take options. It is specified
that "Implementations shall not support any options."
(We have options, though,  so things are complicated.)

Furthermore, the specification explicitly speaks of -- thusly:

"The echo utility shall not recognize the "--" argument in the manner
specified by Guideline 10 of XBD Utility Syntax Guidelines; "--"
shall be recognized as a string operand."



Reply via email to