arehbein has uploaded this change for review.

View Change

WIP: ttcn3-tcpdump*.sh: Fix output of special chars

Don't print '-e' option in non-bash shells.

Related: OS#5736

Change-Id: I4f259e50465132a123ac47b1638de878759a9ba4
---
M ttcn3-tcpdump-stop.sh
1 file changed, 10 insertions(+), 3 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/30/30130/1
diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh
index 2ddae71..a649fd0 100755
--- a/ttcn3-tcpdump-stop.sh
+++ b/ttcn3-tcpdump-stop.sh
@@ -23,10 +23,17 @@

date

-if [ x"$VERDICT" = x"pass" ]; then
- echo -e "\033[1;32m====== $TESTCASE $VERDICT ======\033[0m"
+# -e only works/is required only in Bash; in dash/POSIX shells it isn't required and will be part of the output
+if (lsof -p $$ | grep -q /usr/bin/bash); then
+ ESCAPE_OPT="-e"
else
- echo -e "\033[1;31m------ $TESTCASE $VERDICT ------\033[0m"
+ ESCAPE_OPT=""
+fi
+
+if [ x"$VERDICT" = x"pass" ]; then
+ echo $ESCAPE_OPT "\033[1;32m====== $TESTCASE $VERDICT ======\033[0m"
+else
+ echo $ESCAPE_OPT "\033[1;31m------ $TESTCASE $VERDICT ------\033[0m"
fi
echo


To view, visit change 30130. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: arehbein/wip
Gerrit-Change-Id: I4f259e50465132a123ac47b1638de878759a9ba4
Gerrit-Change-Number: 30130
Gerrit-PatchSet: 1
Gerrit-Owner: arehbein <arehbein@sysmocom.de>
Gerrit-MessageType: newchange