1
0
Fork 0
mirror of https://github.com/sbrl/bin.git synced 2018-01-10 21:33:46 +00:00

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

17
.bashrc
View file

@ -73,12 +73,23 @@ set_bash_prompt()
{ {
# Update the history file after every command # Update the history file after every command
# This prevents a loss of history in the case of an unclean exit # 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\]" PS1="${debian_chroot:+($debian_chroot)}${HOST_COLOUR}\u@\H\[\033[00m\]$(prompt_colon)\[\033[01;34m\]\w\[\033[00m\]"
if [[ "$UID" = 0 ]]; then if [[ "$UID" = 0 ]]; then
PS1="${PS1}# " PS1="${PS1}${dollar_colour}#${RS} "
else else
PS1="${PS1}\$ " PS1="${PS1}${dollar_colour}\$${RS} "
fi fi
} }