The behaviour of
Depends on the implementation and/or the environment.
With UNIX-compliant implementations, it outputs a ESC character followed by NL, in some others, it outputs
\033 followed by NL. Some support a
-e option for those
\033 escape sequences to be expanded.
Your script has a
#! /bin/bash she-bang, but you're running the script as
sh the-script, so
sh interprets it, not
On most systems,
echo builtin doesn't expand
\x sequences by default. It only does so when the
xpg_echo option is enabled or by using the
-e option (unless both the
posix options have been enabled).
Probably your local
sh implementation is a UNIX-compliant one in that regard (like
bash compiled with the
xpg_echo option enabled by default), but the one on the remote server is not (like
If you want a portable and reliable behaviour, use
printf '[\33[01;32m green \33[01;37m]\n'
printf '[\33[01;31m red \33[01;37m]\n'