|
|
|
|
|
by kingvash
3160 days ago
|
|
I've added a counter (of successful commands in a row) to my bashrc. I've seen it as high as 120. function promptCommand()
{
LAST_STATUS=$?
# Set title of window to dir, then add new line to prompt.
PS1='\[\e]0;\w\a\]\n'
if [ $LAST_STATUS -eq 0 ]; then
((successes++))
PS1+='\[\033[1;32m\][$successes]'
else
successes=0
PS1+='\[\033[1;31m\][0 $LAST_STATUS]'
fi
PS1+='\[\033[0;32m\] '
PS1+='\w $(date +%H:%M) \$ \[\033[0m\]'
}
lastStatus=0
successes=-1
PROMPT_COMMAND="promptCommand"
My prompt: [0] /home/bar/g3 14:19 $ echo "boo"
boo
[1] /home/bar/g3 14:19 $
|
|