Monday, February 20, 2006

Cool Dynamic Bash Prompt

Put the following code in your .bashrc and you will see a lovely prompt.
The only problem is that it is a bit slow with the external "date" program.
You may write your own small apps to print out dynamic Bash prompt.
-----------------------------
function smiley () {
echo -e ":\\$(($??50:51))"
}

function thetime () {
echo -e `date +%H:%M`
}

export PS1="\$(smiley) \$(thetime) \w > "