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

Bug#48247: echo -n



On Mon, Oct 25, 1999 at 01:36:26AM -0400, Raul Miller wrote:
> 
> Rereading my copy of chapter 4.19 of the POSIX 1003.2 draft:
> 
> <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>
> 
> I see nothing here that forbids supporting -e

OK, POSIX actually sanctions the use of -e *if* the string to echo
contains back slashes.  But it is not because of the above bit,
since it is overridden by this:

 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.

So echo -e '\007' is allowed to just beep, but echo -e 'hello' must
produce

-e hello

In this respect, both ash and bash are still in violation.

> So I recommend that any shells which have historically supported -e
> continue to do so, but that debian policy make no explicit mention
> of this issue.

If the policy is to make no further mention of -e and escape codes,
then we need to start fixing all shell scripts using them.
-- 
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: