From 32943a97baeecbd1edfcf713f1511153b182fae7 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Mon, 30 Dec 2019 12:38:25 -0500 Subject: [PATCH] add xargs to properly check for empty activeChildren string --- shredder.sh | 4 ++++ 1 file changed, 4 insertions(+) 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