From 16db04fa8aaf8798dc901b419b6b4341b86b7f33 Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Fri, 17 Dec 2021 18:21:55 +0100 Subject: [PATCH] REFACTOR: Refactored core.sh to avoid SC2046 * Affects functions shutdown (L#40) * and err_exit (L#53) Signed-off-by: Stephan Wendel --- libs/core.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/core.sh b/libs/core.sh index e33044a..1148df0 100755 --- a/libs/core.sh +++ b/libs/core.sh @@ -37,7 +37,9 @@ function err_exit { log_msg "Goodbye..." fi if [ -n "$(jobs -pr)" ]; then - kill $(jobs -pr) + jobs -pr | while IFS='' read -r job_id; do + kill "${job_id}" + done fi exit 1 } @@ -48,7 +50,9 @@ function shutdown { log_msg "Shutdown or Killed by User!" log_msg "Please come again :)" if [ -n "$(jobs -pr)" ]; then - kill $(jobs -pr) + jobs -pr | while IFS='' read -r job_id; do + kill "${job_id}" + done fi log_msg "Goodbye..." exit 0