coreutils
[Top][All Lists]
Advanced

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

/bin/echo -- $var


From: Harald Dunkel
Subject: /bin/echo -- $var
Date: Wed, 14 Aug 2019 14:01:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Hi folks,

I just learned by accident that

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

actually prints

        -- -n

Shouldn't it be just

        -n
?

Other tools in coreutils use '--' to indicate "stop parsing for
command line flags", e.g. touch, ls and rm:

        % /bin/touch -- -l
        % /bin/ls -- -l
        -l
        % /bin/rm -- -l
        % /bin/rm -- -l
        /bin/rm: cannot remove '-l': No such file or directory

Some common style would be nice here.


Regards
Harri



reply via email to

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