echocommand. It just takes input and writes it back out again – pretty simple, right? WRONG. Solaris has at least one shell, it seems, that has a version of echo with epic bugs. For instance, here’s what it does when you give it the
-nflag, which tells it not to print a newline after echoing the input:
$ echo -n "I love Solaris" -n I love Solaris $
Yes, instead of either ignoring the
-n flag, or even throwing an unrecognized option error, it echos the flag to the screen! This is quite possibly the worst behavior I’ve ever seen in a core UNIX utility. Also, notice that it printed a newline, like I asked it not to? That broke autoconf, since my version number in my AC_INIT call ended up with a newline in it, and strings with random newlines in them don’t compile too well in C…
I also found yet another bug in Solaris echo just Googling out of curiosity. Turns out that the
-e flag is also unsupported! Whoever is responsible for maintaining this code, can you please bring it up current with early 1990’s echo functionality? Thank you.