1
0
Fork 0

Change dollar sign / hash depending on jobs currently running

This commit is contained in:
Starbeamrainbowlabs 2018-01-03 23:01:26 +00:00
parent 2a3b98607d
commit fb6bf89469
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 14 additions and 3 deletions

17
.bashrc
View File

@ -73,12 +73,23 @@ set_bash_prompt()
{
# Update the history file after every command
# This prevents a loss of history in the case of an unclean exit
history -a
history -a;
# Make the dollar sign bold if there are background jobs, and
# underlined if there are stopped jobs
local dollar_colour="";
if [ $(jobs -r | wc -l) -gt "0" ]; then
dollar_colour="${HC}";
fi
if [ $(jobs -s | wc -l) -gt "0" ]; then
dollar_colour="${dollar_colour}${UL}";
fi
PS1="${debian_chroot:+($debian_chroot)}${HOST_COLOUR}\u@\H\[\033[00m\]$(prompt_colon)\[\033[01;34m\]\w\[\033[00m\]"
if [[ "$UID" = 0 ]]; then
PS1="${PS1}# "
PS1="${PS1}${dollar_colour}#${RS} "
else
PS1="${PS1}\$ "
PS1="${PS1}${dollar_colour}\$${RS} "
fi
}