X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/868a58fbadafd6ad2c10b70520ba6a64479f20ab..c3c5720e1e742e389fdfab3091b3c397e98ddade:/unitproc/bktemp-count_jobs?ds=sidebyside 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";