07-23-07 06:21 PM
Roger Leigh wrote:
> Bob Nelson <bnelson@nelsonbe.com> writes:
>
>
> Nothing. GNU echo (coreutils) as well as the bash echo builtin
> support options (-e, -n etc.). There might be some ancient reason for
> the BSD behaviour, but it's certainly neither universal nor required.
It is required by POSIX:
"The echo utility shall not recognize the "--" argument in the
manner specified by Guideline 10 of the Base Definitions volume of
IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines;
"--" shall be recognized as a string operand.
Implementations shall not support any options.
[...]
If the first operand is -n, or if any of the operands contain a
backslash ('') character, the results are implementation-defined."
Note that it says "operand" when referring to -n, not "option".
POSIX requires "echo -e foo" to output "-e foo", and as far as I'm
aware GNU echo and the builtin echo in bash are the _only_ versions
of echo that do not conform to this POSIX requirement.
--
Geoff Clare <netnews@gclare.org.uk>
[ Post a follow-up to this message ]
|