coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /bin/echo -- $var


From: Kaz Kylheku (Coreutils)
Subject: Re: /bin/echo -- $var
Date: Wed, 14 Aug 2019 09:28:22 -0700
User-agent: Roundcube Webmail/0.9.2

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

[Prev in Thread] Current Thread [Next in Thread]