Only call kill when there are background jobs
This commit is contained in:
2
test.sh
2
test.sh
@@ -18,7 +18,9 @@ cleanup() {
|
|||||||
rm -rf "${tmpdir}"
|
rm -rf "${tmpdir}"
|
||||||
pids=()
|
pids=()
|
||||||
jobs -p | while IFS="" read -r line; do pids+=("$line"); done
|
jobs -p | while IFS="" read -r line; do pids+=("$line"); done
|
||||||
|
if (( "${#pids[@]}" > 0)) ; then
|
||||||
kill "${pids[@]}"
|
kill "${pids[@]}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
download_iso() {
|
download_iso() {
|
||||||
|
|||||||
Reference in New Issue
Block a user