[PATCH 11/12] tests: improve getopt loop error case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>

Avoid exit 1 in test scripts. Simplify and complete redirection
to TS_OUPUT.

Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
---
 tests/ts/misc/getopt | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tests/ts/misc/getopt b/tests/ts/misc/getopt
index 715ec36..460f8a8 100755
--- a/tests/ts/misc/getopt
+++ b/tests/ts/misc/getopt
@@ -31,17 +31,18 @@ eval set -- "$TEMP"
 
 while true ; do
 	case "$1" in
-		-a|--a-long) echo "Option a" >> $TS_OUTPUT 2>&1; shift ;;
-		-b|--b-long) echo "Option b, argument \`$2'" >> $TS_OUTPUT 2>&1; shift 2 ;;
+		-a|--a-long) echo "Option a"; shift ;;
+		-b|--b-long) echo "Option b, argument \`$2'"; shift 2 ;;
 		-c|--c-long)
 			case "$2" in
-				"") echo "Option c, no argument" >> $TS_OUTPUT 2>&1; shift 2 ;;
-				*)  echo "Option c, argument \`$2'" >> $TS_OUTPUT 2>&1; shift 2 ;;
+				"") echo "Option c, no argument"; shift 2 ;;
+				*)  echo "Option c, argument \`$2'"; shift 2 ;;
 			esac ;;
 		--) shift ; break ;;
-		*) echo "Internal error!" >> $TS_OUTPUT 2>&1; exit 1 ;;
+		*) echo "Internal error!"; break;;
 	esac
-done
+done >> $TS_OUTPUT 2>&1
+
 echo "Remaining arguments:" >> $TS_OUTPUT 2>&1
 for arg do echo '--> '"\`$arg'" >> $TS_OUTPUT 2>&1; done
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux