From 1f95337db3a62c373392a25c1941adaad745d608 Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 18 May 2023 22:33:21 +0200 Subject: Fixed Jobs indicator bug/behavior of jobs command inside of function --- .config/zsh/.zshrc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 27159da..2e46d49 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -72,11 +72,15 @@ git_branch_test_color() { # Job indicator jobs_status_indicator() { - local jobs_count=$(jobs | wc -l) - if [[ "$jobs_count" -gt 0 ]]; then + local jobs_output + declare -p jobs_output >/dev/null 2>&1 + if [[ $? -eq 0 ]]; then + unset jobs_output + fi + jobs_output=$(jobs -s) + if [[ -n "$jobs_output" ]]; then + local jobs_count=$(echo "$jobs_output" | wc -l) echo "jobs: ${jobs_count}" - else - echo "" fi } -- cgit v1.2.3