[PATCH] osmo-ttcn3-hacks[master]: log_merge: Use shelcheck to harden the script

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Mar 18 14:22:49 UTC 2018


Review at  https://gerrit.osmocom.org/7368

log_merge: Use shelcheck to harden the script

Change-Id: I1b3a35b5f7ada2dbb0401a5d90a77a53979e1183
---
M log_merge.sh
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/68/7368/1

diff --git a/log_merge.sh b/log_merge.sh
index df52cfe..dee9cc2 100755
--- a/log_merge.sh
+++ b/log_merge.sh
@@ -7,7 +7,7 @@
 #
 # the output files will be called "Module-Testcase.merged"
 
-if [ "x$1" == "x" ]; then
+if [ "x$1" = "x" ]; then
 	echo "You have to specify the Test Suite prefix"
 	exit 2
 fi
@@ -15,16 +15,16 @@
 BASE_NAME="$1"
 LOG_FILES="$BASE_NAME*.log"
 
-TEST_CASES=`ls -1 $LOG_FILES | awk 'BEGIN { FS = "-" } { print $2 }' | sort | uniq`
+TEST_CASES=$(ls -1 $LOG_FILES | awk 'BEGIN { FS = "-" } { print $2 }' | sort | uniq)
 
 for t in $TEST_CASES; do
 	PREFIX="$BASE_NAME-$t"
 	OUTPUT="$BASE_NAME.$t.merged"
-	ttcn3_logmerge $PREFIX-*.log > $OUTPUT
+	ttcn3_logmerge $PREFIX-*.log > "$OUTPUT"
 	echo "Generated $OUTPUT"
 done
 
-if [ "$2" == "--rm" ]; then
+if [ "$2" = "--rm" ]; then
 	echo "Removing Input log files !!!"
-	rm $LOG_FILES
+	rm "$LOG_FILES"
 fi

-- 
To view, visit https://gerrit.osmocom.org/7368
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b3a35b5f7ada2dbb0401a5d90a77a53979e1183
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list