Posts Tagged ‘bash’

Albatross

Sunday, March 7th, 2010

My Bash bases photo album generator Albatross is back by popular demand. If you are hacking your own version I’d be happy to integrate it with the base code.

www.ichimusai.org/albatross

Your favourite prompt

Tuesday, March 2nd, 2010

Today’s Bash tip. Create a prompt that changes face depending on the return code of your last command. As long as the return code is OK you get a happy face. When it is false you get a sad one.

Open and edit the .bashrc file in your home directory and enter the following:

PS1="\u@\h:\[\e[33m\]\w\[\e[0m\] \[\`if [[ \$? = "0" ]]; \
then echo '\e[32m=)\e[0m'; else echo '\e[31m=(\e[0m' ; fi\`\] \$ "

Have fun.