arehbein has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/30312 )

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

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

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

Related: OS#5736
Change-Id: Idac0f902d2f5eb142a3f130409451c8f77b111f6
---
M ttcn3-tcpdump-stop.sh
1 file changed, 10 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  msuraev: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh
index 829ed2b..0568054 100755
--- a/ttcn3-tcpdump-stop.sh
+++ b/ttcn3-tcpdump-stop.sh
@@ -24,10 +24,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 https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/30312
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Idac0f902d2f5eb142a3f130409451c8f77b111f6
Gerrit-Change-Number: 30312
Gerrit-PatchSet: 1
Gerrit-Owner: arehbein <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: arehbein <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: msuraev <[email protected]>
Gerrit-MessageType: merged

Reply via email to