[Toybox] ps and top (and Android)

Andy Chu andychup at gmail.com
Sun Apr 24 16:55:35 PDT 2016


>> if that was the intention, it's useless anyway, given the
>> posix-specified -- for all argument parsing.
>
> About that:
>
> $ echo -- hello
> -- hello
> $ /bin/echo -- hello
> -- hello
>
> _I'm_ doing it, but the gnu tools aren't, and nobody seems to have cared.
>
> Posix does not seem to be aware that it's been losing traction for a
> while now. My own last attempt to engage with the posix mailinglist made
> it as far as:

I'm pretty sure that's for backward compatibility, not because the
bash or GNU coreutils maintainers are ignorant of POSIX or don't care.

There is an in-depth discussion of echo in the book "Portable Shell
Scripting" I referred to:

https://books.google.com/books?id=3ETiIJG1UB4C&pg=PA183&lpg=PA183&dq=portable+shell+scripting+public+enemy+1+echo&source=bl&ots=1Ps1NAaM-1&sig=_KN0uPhyVvceuZwojK5ysJtDyng&hl=en&sa=X&ved=0ahUKEwjjgvzCuajMAhWruoMKHYNrAOwQ6AEIHDAA#v=onepage&q=portable%20shell%20scripting%20public%20enemy%201%20echo&f=false

Hopefully that is readable, but the gist is that sometimes -n is a
flag and sometimes it is echo'd; same thing with -- I guess.
Apparently "echo" is one of the most un-portable builtins in practice.
I think he suggests using printf instead of echo somewhere.

This book actually goes into some detail about historical bugs in
different shells...

Andy



More information about the Toybox mailing list