bug-bash
[Top][All Lists]
Advanced

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

Re: [PATCH] Adding support for '--' in builtin echo's option parsing.


From: Dan Douglas
Subject: Re: [PATCH] Adding support for '--' in builtin echo's option parsing.
Date: Mon, 01 Apr 2013 15:48:10 -0500
User-agent: KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; )

On Monday, April 01, 2013 03:32:16 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?

print(1) is an option for those that want --. AFAIK, it's consistent 
everywhere it's been implemented. There's a (barebones) example loadable, and 
it's quite easy to define a print shiv in shell if needed.

Although, comparing the length:

printf %s
print -rn

It's just as easy to type printf.
-- 
Dan Douglas



reply via email to

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