add better bash stuff

see http://robertmuth.blogspot.com.au/2012/08/better-bash-scripting-in-15-minutes.html