Bug 6933 - /bin/echo now requires '-e' arg to recognize escape characters
/bin/echo now requires '-e' arg to recognize escape characters
Product: Red Hat Linux
Classification: Retired
Component: sh-utils (Show other bugs)
i386 Linux
high Severity medium
: ---
: ---
Assigned To: bero
Depends On:
  Show dependency treegraph
Reported: 1999-11-11 13:27 EST by Nishanth Thomas
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-02-05 15:49:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Nishanth Thomas 1999-11-11 13:27:46 EST
In the sh-utils version 2.0 that is shipped with 6.1 the
echo.c source file has the following line:

/* #define V9_DEFAULT */

Because this is commented out the /bin/echo utility requires
that a '-e' flag be passed to enable escape character
recognition.  Following is an example of the behavior:

[nthomas@daisy src]$ /bin/echo "test\c"
[nthomas@daisy src[$

/bin/echo -e "test\c"
test[nthomas@daisy src]$

This is <IMHO> the _right_ behavior in a lot of ways (the
shell version does this), but many Linux users will find
their scripts are broken by this.  That is because in an
effort to avoid adding '-e' to their scripts they use the
following line:

[ -n "$BASH_VERSION] && { enable -n echo ; }

to enable the /bin/echo command instead of the shell echo
command.  Now that the two versions behave the same way they
are having a lot of problems with their existing code.

So, while I'm not sure this code can be called 'broken' it
does seem to favor a theoritical goodness over the needs of
the users.

(There have, btw, been 5 separate ISV complaints on this
Comment 1 Bill Nottingham 2000-02-05 15:49:59 EST
Unfortunately, the echo -e behaviour is a POSIX-ism, and
therefore won't be fixed.

Note You need to log in before you can comment on or make changes to this bug.