Long time Mac (read GUI) user who recently started running Ubuntu and has spent a week or so customizing my .bashrc (Ubuntu) file and .bash_profile (Mac) for informative and colorful PS1 and terminal output.
I've got this tiny little function:
function colors2nums()
{ for code in {0..255}; do echo -e "\e[38;05;${code}m $code: Test"; done }
that displays 256 colors with codes so I can choose the one I want...
It works perfectly in Ubuntu (14.0.4 LTS, Gnome terminal) and does not work at all on the Mac (OS 10.7.5 both iTerm & Terminal.app).
The PROMPT_COMMAND function of the .bashrc file on Ubuntu is exactly the same, copied & pasted line-for-line as the Mac's PROMPT_COMMAND function is in .bash_profile.
Both PS1 prompts are identical in color (with just some odd spacing on the Mac side) and ls -GFa (or any variant) prints in the colors set by LS_COLORS and .dircolors. So colors are working for some output, but not all. On the Mac, I get 256 lines in the same color as my terminal input set by the last escaped color (green, white, whatever) in my PS1.
WTH?!?
And yes, I've tried 2 variations of the trap - DEBUG (hack?):
#trap 'echo -ne \e[0m' DEBUG
trap 'printf "\e[0m" "$_"' DEBUG
that works to reset the output on the Ubuntu side of things. Neither works on the Mac.
What am I missing?