REFACTOR: Refactored core.sh to avoid SC2046

* Affects functions shutdown (L#40)
* and err_exit (L#53)

Signed-off-by: Stephan Wendel <me@stephanwe.de>
This commit is contained in:
Stephan Wendel 2021-12-17 18:21:55 +01:00
parent 24f9257a47
commit 16db04fa8a
No known key found for this signature in database
GPG Key ID: F465B83ACBA45639

View File

@ -37,7 +37,9 @@ function err_exit {
log_msg "Goodbye..." log_msg "Goodbye..."
fi fi
if [ -n "$(jobs -pr)" ]; then if [ -n "$(jobs -pr)" ]; then
kill $(jobs -pr) jobs -pr | while IFS='' read -r job_id; do
kill "${job_id}"
done
fi fi
exit 1 exit 1
} }
@ -48,7 +50,9 @@ function shutdown {
log_msg "Shutdown or Killed by User!" log_msg "Shutdown or Killed by User!"
log_msg "Please come again :)" log_msg "Please come again :)"
if [ -n "$(jobs -pr)" ]; then if [ -n "$(jobs -pr)" ]; then
kill $(jobs -pr) jobs -pr | while IFS='' read -r job_id; do
kill "${job_id}"
done
fi fi
log_msg "Goodbye..." log_msg "Goodbye..."
exit 0 exit 0