Subject: discrepency beteen /bin/echo and builtin echo of /bin/sh
To: None <email@example.com>
From: David Laight <firstname.lastname@example.org>
Date: 06/07/2002 22:31:56
I was perusing the source for the builtin echo of 'sh'
(src/bin/sh/bltin/echo.c) and noticed code that
it looks for a '-e' paramter.
This is neither documented nor well written, nor does /bin/echo
behave the same way.
The actual behavior is:
echo [ -e | -n ] args
Write 'args' to stdout.
A newline is appended unless '-n' is specified/
If '-e' is specified certain \ escape sequences are translated....
1) -e and -n are mutually exclusive - you can't specify both.
2) /bin/echo doesn't support -e
3) echo -e 'abc\cdef' doesn't print 'def'
Interestingly the man page for (pd)ksh says that -e (to echo)
is supported for BSD compatibilty...
(I recall having a discussion fairly recently in one of the
groups about the differences between various versions of echo
- but can't seem to find it....)
David Laight: email@example.com