Skip to main content

All Questions

3 votes
2 answers
7k views

Escape characters from echo -e

I have the following in my .bashrc file I use for a log: function log(){ RED="\e[0;31m" RESET="\e[0m" echo -e "${RED}$(date)" "${RESET}$*" >> "$HOME"/mylog.txt } But when I do something ...
Proletariat's user avatar
9 votes
7 answers
19k views

echo \\* - bash backslash escape behavior, is it evaluated backwards?

So in bash, When I do echo \* * This seems right, as * is escaped and taken literally. But I can't understand that, when I do echo \\* \* I thought the first backslash escaped the second one ...
Weishi Z's user avatar
  • 213
4 votes
1 answer
2k views

Printing colored text using script

When I type below command in the shell I get the OUTPUT in green color. Command echo "\033[32mCONNECTING TO abpwrk\033[m"; Output(in green color) CONNECTING TO abpwrk But if I use the same ...
g4ur4v's user avatar
  • 1,774