MacOS Leopard bash echo not interpreting escape sequences

I just hit this incredibly retarded irritating gotcha in Mac OS Leopard. Luckily, unlike this poor bastard, it only cost me an hour.

Bash echo is supposed to interpret \ escape sequences (e.g. \n) if you supply it a -e flag. This works from the command line. It works in shell scripts. It works in ’system’ commands inside rake scripts. Unless of course you ssh into the very same system and run the same rake script; then it stops working.

I tracked this down to the COMMAND_MODE=legacy environment variable, which if missing (and it is missing if I ssh in) makes Leopard do all sorts of stupid Single UNIX Specification Version 3 (SUSv3) compatibility crap. As Stephen points out, this even breaks GNU autoconf scripts! Way to go, Apple – talk about missing the point completely.

You must be logged in to post a comment.