echo does not recognize backslash escapes in POSIX mode
From:
Matthew Fischer
Subject:
echo does not recognize backslash escapes in POSIX mode
Date:
Tue, 11 May 2004 21:54:40 -0500 (CDT)
When POSIXLY_CORRECT is set in the environment, echo does not recognize
the backslash escapes specified in SUSv2:
$ POSIXLY_CORRECT=1 /bin/echo 'string\c'
string\c
$
It should produce the following instead:
$ POSIXLY_CORRECT=1 /bin/echo 'string\c'
string$
I had a configure script fail today because of this bug.
I think that when POSIXLY_CORRECT is set, echo needs to behave as if the
-e option were specified. You can't actually give echo the -e option in
POSIX mode, because it won't accept any options (which is correct
behavior):
$ POSIXLY_CORRECT=1 /bin/echo -e 'string\c'
-e string\c
That, however, means that there is no way to use the POSIX escapes in
POSIX mode.
I am using coreutils 5.0 on i686 Linux (Slackware 9.1).