[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Adding support for '--' in builtin echo's option parsing.
From: |
Eric Blake |
Subject: |
Re: [PATCH] Adding support for '--' in builtin echo's option parsing. |
Date: |
Mon, 01 Apr 2013 13:49:41 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 |
On 04/01/2013 01:32 PM, Dave Rutherford wrote:
> On Mon, Apr 01, 2013 at 03:16:07PM +0300, Hemmo Nieminen wrote:
>>> Description:
>>> Currently it seems to be impossible to e.g. print "-n" with the
>>> builtin
>>> echo witout any extra characters.
>>
>> You should use printf instead. The echo command is a historical artifact
>> which cannot be used for general-purpose output.
>>
>> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html says:
>>
>> 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.
>
> Perhaps this is worth adjusting unless POSIXLY_CORRECT?
No. Existing scripts already rely on existing behavior, and changing
the behavior of 'echo' is just asking for problems. Use 'printf' instead.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature