From fd3e0d6ee9460cda9c5612ce3526718ea5815353 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 10 Sep 2013 14:04:55 +1200 Subject: Use builtins only for prompt job count --- bash/bashrc.d/prompt.bash | 8 ++++++-- 1 file 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 -- cgit v1.2.3