[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Builtin command echo does not work properly.
From: |
Eric Blake |
Subject: |
Re: Builtin command echo does not work properly. |
Date: |
Thu, 20 Apr 2006 00:03:31 +0000 |
>
> Description:
> The builtin command echo [-neE] [arg ...] does not work properly
>
> Repeat-By:
> Enter:
> echo -E "\ttext"
> Expected result:
> \ttext
> Result:
> -E text
Not a bug. POSIX requires that echo prints everything without regards
to options, with escape sequences active. If you are using bash in
a manner specified by POSIX, such as invoking it by the name /bin/sh,
this is the behavior you should expect. However, there is also the
xpg_echo option in shopt which controls this somewhat.
For example, I just did:
$ echo -E "\ttext" $BASH_VERSION $0
\ttext 3.1.14(4)-release /bin/bash
$ shopt xpg_echo
xpg_echo off
> Fix:
> Use /usr/bin/echo to work around this problem.
/usr/bin/echo from coreutils is not yet fully POSIX compliant, which is why
it will accept options even when bash won't.
--
Eric Blake