diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2013-09-10 14:04:55 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2013-09-10 14:04:55 +1200 |
commit | fd3e0d6ee9460cda9c5612ce3526718ea5815353 (patch) | |
tree | 795eb94fbd5c0245c924a7238d3e3d1e25122444 /bash | |
parent | Better syntax for array append (diff) | |
download | dotfiles-fd3e0d6ee9460cda9c5612ce3526718ea5815353.tar.gz dotfiles-fd3e0d6ee9460cda9c5612ce3526718ea5815353.zip |
Use builtins only for prompt job count
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bashrc.d/prompt.bash | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 6ecf44ba..8927e732 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -168,8 +168,12 @@ prompt() { # Show the count of background jobs in curly brackets job) - if [[ $(jobs) ]]; then - printf '{%d}' "$(jobs | sed -n '$=')" + local jobc=0 + while read -r line; do + ((jobc++)) + done < <(jobs) + if ((jobc > 0)); then + printf '{%d}' "$jobc" fi ;; esac |