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

Bug#48247: echo -n



On Mon, Oct 25, 1999 at 09:08:51PM +1000, Herbert Xu wrote:
> So, unless the first operand is -n, or if the string contains backslash
> characters, the operands are to be written to the standard output verbatim
> separated by sngle spaces with a new line at the end.  If the first operand
> is -n, or if there are backslash characters, anything can happen.
> 
> Applying this to the case
> 
> echo -e hello
> 
> the first operand is not -n and there are no backslashes, so the output must
> be
> 
> -e hello

Except you elected to not quote what posix said about options:

<quote>
 4.19.3  Options

 The echo utility shall not recognize the -- argument in the manner
 specified by utility syntax guideline 10 in 2.10.2; -- shall be
 recognized as a string operand.

 Implementations need not support any options.
</quote>

So the interpretation you're suggesting is *legal* for a POSIX
implementation of /bin/sh, but it's fairly clear that it's not
*required* for a POSIX implementation of /bin/sh

It's fairly clear from 2.10.1 that options are not operands.  [Also note
the parts of 2.10.2 which were not explicitly superceeded in 4.19.]

If options are forbidden by posix it's reasonable to expect that
the command must support their treatment as operands.  However
when they're merely not required it's reasonable for that to vary
from one system to another.

-- 
Raul


Reply to: