New terminal prompt
When I was preparing to use Cucumber I watched a screen cast. I saw a cute promt there: it was single-char green happy face if last command was successful (returned 0) or single-char red sad face if it wasn’t. This motivated me to change my own prompt which was default prompt for Gentoo:
login@hostname /full/path/to/current/dir $
It wasn’t bad but it could get really long if I was deep in directory structure and I really know my login and host… My current promt is
current_dir HH:MM :)
If last command was succesful and
current_dir HH:MM :(
if it failed. I changed prompt for just my user by adding to ~/.bashrc
export PS1="\[\e[34m\]\W \[\e[0m\]\`if [ \$? = 0 ]; then
echo \[\e[32m\]\A \:\)\[\e[0m\];
else
echo \[\e[31m\]\A \:\(\[\e[0m\]; fi\` "
And a screenshot so you can compare how much space I’m saving when I’m in some deep directory: