[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] latest ash has broken 'echo' command



* Herbert Xu said:
> On Thu, Oct 21, 1999 at 03:20:40PM +0200, Marek Habersack wrote:
> >
> > During the Debian packages upgrade I saw many, many '-n something' messages,
> > meaning that many packages use -n. Perhaps SUS should be changed? The
> > echo manpage from ash says it supports -n and -e paramerters. The shellutils
> > echo also supports these options. I don't see what's the rationale behind
> > the SUS restriction? Why wouldn't echo support options that are so commonly
> > used?
> 
> SuS disallows options because echo traditionally did not allow -- to indicate
Hmm... but tradition has changed and now most, if not all, shell programmers
expect echo to accept all those arguments. If the restriction had really
important basis, then it should be enforced, but I can really see no reason
why it should...

> that no further options are to be used.  This means that if options were
> allowed you cannot echo a line that begins with -.  Anyway, echo cannot be
Hmm, but it can. Look at the code I wrote - it accepts only '-e' and '-n',
all the other arguments starting with '-' are output verbatim. If it is
necessary, one can add the '--' parameter to end the processing of the
arguments and start output. Also an escape sequence can be used to output
the dash.

> used portably with escape codes and lines that begin with -, that is why
> the SuS recommends you to use printf instead.
Not really a practical solution for existing thousands of scripts out
there...

marek

Attachment: pgpT5OrcA0O8h.pgp
Description: PGP signature


Reply to: