Writings on various topics (mostly technical) from Oliver Hookins and Angela Collins. We currently reside in Sydney after almost a decade in Berlin, have three kids, and have far too little time to really justify having a blog.
At $employer today, we had our bi-weekly tech talk session and one of the lightning talks given was on tmux. Tmux is an excellent piece of software (although I gave up on it and started using iTerm2) but that's not what I wanted to talk about.
One of the other participants in the session noticed the presenter's
shell prompt had a little smiley/frowney face which changed both
expression and colour depending on the exit code of the last command -
how cool is that? How many times have we all typed echo $? just to
find out if our last command was really successful? It really makes
sense to have this information displayed at all times.
So in that spirit I'm sharing my PS1 prompt variable with you. It's not the most advanced, doesn't use all of the bells and whistles and I'm still not entirely sure the information it presents is essential but it's a work in progress. I'd love for you to share your own in the comments in the hope of spreading know-how and ideas!
export PS1="`if [ $? = 0 ]; then echo e[33\;40m\\^\\_\\^e[0m; else echo e[36\;40m\\\-e[0m\\_e[36\;40m\\\-e[0m; fi` \[\033[38m\]u \[\033[0;36m\]j \[\033[1;32m\]\!\[\033[01;34m\] w \[\033[31m\]`ruby -e "print (%x{git branch 2> /dev/null}.split(%q{n}).grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')"`\[\033[37m\]$\[\033[00m\] "
Roughly in order, this equates to:
On my machine it looks like this:

What does yours look like?