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

Bug#48247: echo -n



On Mon, Oct 25, 1999 at 03:03:34AM -0400, Raul Miller wrote:
> On Mon, Oct 25, 1999 at 04:51:42PM +1000, Herbert Xu wrote:
> > IMHO it does. Firstly it's clear from the wording that all "options"
> > come under the operands category.
> 
> It's clear from the wording that only for the -- option is this behavior
> guaranteed.

Let me quote it again:

 4.19.1  Synopsis

 echo  [string ...]

<...deleted...>

 4.19.4  Operands

 The following operands shall be supported by the implementation:

    string      A string to be written to standard output.  If the first
                operand is "-n" or if any of the operands contain a
                backslash (\) character, the results are implementation
                defined.

 4.19.6.1  Standard Output

 The echo utility arguments shall be separated by single <space>s and a
 <newline> character shall follow the last argument.

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
-- 
Debian GNU/Linux 2.1 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Reply to: