bug-bash
[Top][All Lists]
Advanced

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

Re: echo "-e" produces no outputs


From: Chet Ramey
Subject: Re: echo "-e" produces no outputs
Date: Sun, 19 Jul 2009 21:07:20 -0400
User-agent: Thunderbird 2.0.0.22 (Macintosh/20090605)

Stephane CHAZELAS wrote:
> 2009-07-17, 13:09(-06), Eric Blake:
>> According to Huang Tao on 7/17/2009 9:46 AM:
>>> I'm not sure whether it is a bug
>>> how can i echo the text string "-e" barely ( or "-n", "-E")
>>> i tried
>>> $echo "-e"
>>> $echo '-e'
>>> and some other inputs, all of which produced no outputs.
>> Instead of using echo (which POSIX itself admits is fraught with
>> portability problems), use printf:
>>
>> printf -- '-e\n'
> [...]
> 
> Note that it's a known non POSIX-conformance of bash.
> 
> POSIX is explicit that
> 
> echo -e
> 
> Should output "-e\n".

That's why bash has the `xpg_echo' option.  You can build bash in such
a way that it's always enabled.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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