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

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



* Marcus Brinkmann said:
> > True, but I have to KNOW wheter the feature is supported by the given
> > product or not, right?
> 
> Trivial:
> 
> marcus@ulysses[0]:/tmp$ echo -n | wc
>       0       0       0
> marcus@ulysses[0]:/tmp$ echo -- -n | wc
>       1       2       6
> 
> Writing a shell fucntion around it which returns yes or no is left as an
> exercise to the reader :)
Hmm... not quite that good :)). wc is in /usr/bin, that's first. If the test
is put in a loop, then we end up with something which unnecessarily slows
down the script, just to test whether the feature is supported (I know,
nobody should put such a test in a loop :))).
 
> > if [ -n "$POSIX_ECHO_ARG ]; then
> 
> Environment variables for this make me feel uneasy... especially if you want
> to use /bin/echo or different echos.
The environment variables have the advantage that they don't need another
program to test for a feature, access is fast. If you use /bin/echo, then
you don't use your shell's builtin - in that case you don't care about the
environment.

marek

Attachment: pgpS5pIUwcCf4.pgp
Description: PGP signature


Reply to: