I have my current PS1 as follows. The $?
output is really useful (second line).
export PS1="\
${PSOn_Blue}${PSBWhite}\t\
${PSColor_Off} \$?\
${PSColor_Off}${PSBGreen} \u\
${PSColor_Off}${PSWhite}@\
${PSColor_Off}${hostcolor}\h\
${PSColor_Off}:\
${PSBGreen}\w\
${PSColor_Off}\$\
"
It would be even nicer if the return code ($?) would be red on non-zero output.
How can I achieve this?
tput
ensures that it won't produce ugly escape codes if your terminal doesn't support color. – l0b0 Jun 12 '13 at 08:26