commit bb0fb92595dca9bba7ce4e982d9d1975ae18a56c
parent c92e170c3fe58744b69a623ca5cb14bb369ac76b
Author: St John Karp <contact@stjo.hn>
Date: Sat, 9 Oct 2021 10:26:54 -0400
Remove non-digits from process count
`wc` on FreeBSD includes some whitespace before the digit, so we
need to trim any characters that aren't numbers before doing a
numeric comparison.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/squeeze.sh b/squeeze.sh
@@ -95,7 +95,7 @@ find "$source_path" -type f -name "*.md" $find_test |
# or equal to the max processes. We have to subtract one
# because the `ps` command always outputs a header that we
# don't want to count.
- while [ "$(expr "$(ps -p "${proc_ids%% }" | wc -l)" - 1)" -ge "$max_processes" ] ; do
+ while [ "$(expr "$(ps -p "${proc_ids%% }" | wc -l | tr -d -c '[:digit:]')" - 1)" -ge "$max_processes" ] ; do
true
done
done