Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: The "-" and "--" options (was Re: ${var:1:1:=y})



Peter Stephenson <p.stephenson@xxxxxxxxxxx> writes:

> On Wed, 4 Feb 2015 09:10:14 -0800
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>> Also "echo" does NOT accept "--" in this way, it ONLY acceps a solitary
>> "-".  I forget why that is.
>
> I think the decision for echo (some years ago) was that it would be
> better to make it consistent with versions of /bin/echo rather than with
> the normal internal interface, since shell scripts were written to the
> external echo interface even if the shell had the builtin.
>
> It seems this argument still works on Linux at least:
>
> % /bin/echo -- foo
> -- foo
>
> so I think we were (probably) right and this is the best consistency
> we're going to get.

% echo -

% /bin/echo -
-
% /bin/echo --version
echo (GNU coreutils) 8.23

The only winning move is to use printf(1).

-- 
Christian Neukirchen  <chneukirchen@xxxxxxxxx>  http://chneukirchen.org



Messages sorted by: Reverse Date, Date, Thread, Author