I was not able to find an answer to this question, so maybe one of you guys can help me out :)
I wrote some shell scripts to help me automate things, and they work. However, what doesn't work is adding colored text to my
echos. It works when entering the command directly into my terminal, but it does NOT work when I put the command into a *.sh file:
Content of foo.sh:
echo "\n\e[1;37mHello World\e[0m\n"
Can anyone explain to me what the problem is? Oh, and I am using zsh, if that matters.
Thanks a lot in advance :)
Apparently, it works when the content of foo.sh is:
echo $'\n\e[1;37mHello World\e[0m\n'
I found the answer at http://wiki.bash-hackers.org/syntax/quoting, which I found thanks to the answer of netmonk. Therefore, I will accept his answer as the correct one. Thanks mate :)