From e876d266b952e07ce3fef738d8ecc0b943df845e Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Tue, 26 Aug 2014 11:46:32 +0200 Subject: [PATCH] labs: fix getopts use in osbash.sh For invalid options, $opt contains a literal '?' rather than the option itself. This patch disables the builtin error message, which gets us the invalid option passed as OPTARG. Change-Id: I3b0d3d85e6c95f1839eed19679bf4d8af378cc29 --- labs/osbash.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/labs/osbash.sh b/labs/osbash.sh index a28cd9a2..8e06f20f 100755 --- a/labs/osbash.sh +++ b/labs/osbash.sh @@ -54,7 +54,7 @@ function print_config { echo "VM access method: $VM_ACCESS" } -while getopts efhnw opt; do +while getopts :efhnw opt; do case $opt in e) EXPORT_OVA=$IMG_DIR/oslabs-$DISTRO.ova @@ -74,7 +74,7 @@ while getopts efhnw opt; do source "$LIB_DIR/wbatch/batch_for_windows" ;; ?) - echo "Error: unhandled option $opt" + echo "Error: invalid option -$OPTARG" echo usage ;;