From: Rob Landley Date: Fri, 26 Feb 2016 06:22:15 +0000 (-0600) Subject: Switch to $! for make.sh process enumeration. X-Git-Tag: accepted/tizen/unified/20190704.040502~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af96dbed2efa5596ab01d696a9bc9e911ec193e7;p=platform%2Fupstream%2Ftoybox.git Switch to $! for make.sh process enumeration. --- diff --git a/scripts/make.sh b/scripts/make.sh index 7ebe148..6c03b80 100755 --- a/scripts/make.sh +++ b/scripts/make.sh @@ -245,17 +245,17 @@ do LFILES="$LFILES $OUT" [ "$OUT" -nt "$i" ] && continue do_loudly $BUILD -c $i -o $OUT & + PENDING="$PENDING $!" # ratelimit to $CPUS many parallel jobs, detecting errors while true do - PENDING="$(echo $PENDING $(jobs -rp) | tr ' ' '\n' | sort -u)" - [ $(echo -n "$PENDING" | wc -l) -lt "$CPUS" ] && break; + [ $(echo "$PENDING" | wc -w) -lt "$CPUS" ] && break; - wait $(echo "$PENDING" | head -n 1) + wait $(echo "$PENDING" | awk '{print $1}') DONE=$(($DONE+$?)) - PENDING="$(echo "$PENDING" | tail -n +2)" + PENDING="$(echo "$PENDING" | sed 's/^ *[0-9]*//')" done [ $DONE -ne 0 ] && break done