From 700ec49581650ea1f0bffacb207a30145e278417 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sat, 29 Jun 2019 00:17:42 +0200 Subject: 44469: correct error on missing option argument --- Test/B10getopts.ztst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Test') diff --git a/Test/B10getopts.ztst b/Test/B10getopts.ztst index 7eba5a4b1..72c9e209e 100644 --- a/Test/B10getopts.ztst +++ b/Test/B10getopts.ztst @@ -79,3 +79,20 @@ test_getopts +x 1:one illegal option, + variant >test_getopts:3: bad option: +x + + set -- -x + OPTIND=1 + while getopts x: opt; do + echo "$opt,${OPTARG:-Empty}" + done +0:missing option-argument (error message mode) +>?,Empty +?(eval):3: argument expected after -x option + + set -- -x + OPTIND=1 + while getopts :x: opt; do + echo "$opt,${OPTARG:-Empty}" + done +0:missing option-argument (quiet mode) +>:,x -- cgit 1.4.1