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
This commit is contained in:
Roger Luethi 2014-08-26 11:46:32 +02:00
parent e67ada9739
commit e876d266b9

View File

@ -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
;;