bug-bash
[Top][All Lists]
Advanced

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

Re: "echo" does not follow the "getopt" convention


From: Eric Blake
Subject: Re: "echo" does not follow the "getopt" convention
Date: Tue, 19 Aug 2014 06:11:55 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0

On 08/18/2014 07:34 PM, Peng Yu wrote:
> Hi,
> 
> The following shows that echo does not following the "getopt"
> convection. Is it better to make all bash internal command following
> the getopt convention?

No, that would break backward compatibility.

> 
> ~$ echo -n
> ~$ echo -n -n
> ~$ echo -n -- -n # I think that the output should just be "-n" not "-- -n".
> -- -n~$

For that matter, POSIX requires this to output "-n -- -n", since POSIX
does not allow for echo to interpret -n.  In fact, if you do 'shopt -s
xpg_echo', then you get full POSIX behavior.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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