X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/e67680074e04e0eaea680de93133327162d73304..07b20692dcdd8c69f7ee1e074a24deefee010d89:/unitproc/bktemp-count_jobs?ds=inline diff --git a/unitproc/bktemp-count_jobs b/unitproc/bktemp-count_jobs index cf26234..9bde32d 100644 --- a/unitproc/bktemp-count_jobs +++ b/unitproc/bktemp-count_jobs @@ -9,6 +9,14 @@ yell() { echo "$0: $*" >&2; } # print script path and all args to stderr die() { yell "$*"; exit 111; } # same as yell() but non-zero exit status try() { "$@" || die "cannot $*"; } # runs args as command, reports args if command fails count_jobs() { + # Desc: Count and return total number of jobs + # Usage: count_jobs + # Input: None. + # Output: stdout integer number of jobs + # Depends: Bash 5.1.16 + # Example: while [[$(count_jobs) -gt 0]]; do echo "Working..."; sleep 1; done; + # Version: 0.0.1 + local job_count; job_count="$(jobs -r | wc -l | tr -d ' ' )"; #yell "DEBUG:job_count:$job_count";