Smiley Prompt

Students often ask about my smiley/frowny face prompt, which is based on the previous command’s exit code. I certainly did not invent this, but here is my setup:

I would love to cite where I found it, but honestly it’s been so long that I wouldn’t know the exact page if I saw it. Suffice to say that I found it using a search on Google such as “smiley prompt”. Of course, on non-Debian systems I don’t use debian-chroot in the config.

.bashrc

set a fancy prompt

PS1=’${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ‘

BLU=”[\033[0;34m]” #Blue. LGY=”[\033[0;37m]” #Light Gray. LGR=”[\033[1;32m]” #Light Green. LBU=”[\033[1;34m]” #Light Blue. LCY=”[\033[1;36m]” #Light Cyan. LRE=”[\033[1;31m]” #Light Red. YEL=”[\033[1;33m]” #Yellow. WHT=”[\033[1;37m]” #White. RED=”[\033[0;31m]” #Red. OFF=”[\033[0m]” #None. LASTSTAT=”\$(if [ \$? -eq 0 ] ; then echo -n ‘${LGR}:-)${LBU}’ ; else echo -n ‘${LRE}:-(${LBU}’ ; fi )”

PS1=”${LASTSTAT} ${BLU}[${LGR}\H${OFF}${BLU}][${LCY}\w${BLU}]${LBU}\$${OFF} “

PS1=”${LASTSTAT} ${debian_chroot:+($debian_chroot)}${YEL}\u${LBU}@\h:${LCY}\w${LBU}\$${OFF} “

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>