Customizing the Bash prompt to include number of suspended processes
I've read this article and would like to append to my prompt the number of processes I've currently suspended by pressing ctrl + z . According to that list I have to use the
\j
to be able to accomplish this. Ideally, I would like to append a
:(number)
to my prompt that would be red and bold if its greater than zero and regular and white if it was zero. If this "if" behavior is not possible, then I could just have it always white and 开发者_JS百科regular text. Could anyone help me out with this? Below is the output of my PS1 variable.
faramir@dev:~/testDir$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
Thanks!
PS1='...:\[$(((\j > 0))&&{ tput setaf 1;tput bold;})\]\j\[$(tput sgr0)\]...'
精彩评论