summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Stevens <nilix@nilfm.cc>2019-12-30 12:38:25 -0500
committerDerek Stevens <nilix@nilfm.cc>2019-12-30 12:38:25 -0500
commit32943a97baeecbd1edfcf713f1511153b182fae7 (patch)
tree6c6684e7c27bf01e5a6a2d810322ceca9282cf11
parent5ae3818ed833ffcbfe6b1d938679d36368bc154f (diff)
add xargs to properly check for empty activeChildren string
-rw-r--r--shredder.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/shredder.sh b/shredder.sh
index d17bfda..c321183 100644
--- a/shredder.sh
+++ b/shredder.sh
@@ -46,6 +46,10 @@ while true; do
for child in ${children}; do
activeChildren="${activeChildren} $(ps T | grep $child | awk '{print $1}')"
done
+
+ # if no active children, trim the whitespace so we can check for empty string
+
+ activeChildren=$(echo ${activeChildren} | xargs echo)
if [ -z "${activeChildren}" ]; then
break
else