Wednesday, June 19, 2013

BusyBox Limited echo

BusyBox is a program incorporating the functionality of several GNU tools/programs, like for example df, grep, find, mv, and echo. This binary is usually used on embedded devices instead of a full fledged GNU/Linux install. Thus you can call it BusyBox/Linux.

However, as this program is not the exact same code as in GNU/Linux there are differences between them, and some things are not supported. One such difference is that the echo command is a bit limited. There is a flag -e which tells the program to "enable interpretation of backslash escapes". For example change swap foreground and bacground colors with:
echo -e "\e[7m" and echo -e "\e[0m"

Except this won't work on BusyBox (at least in version 1.12.1), echo doesn't accept \e and \x escape sequences. Instead you have to use the octal equivalent so the above would be:

echo -e "\033[7m" and echo -e "\033[0m".

Found at .

No comments:

Post a Comment