summaryrefslogtreecommitdiffstats
path: root/tests/getopts.right
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:38:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:38:56 +0000
commit6c20c8ed2cb9ab69a1a57ccb2b9b79969a808321 (patch)
treef63ce19d57fad3ac4a15bc26dbfbfa2b834111b5 /tests/getopts.right
parentInitial commit. (diff)
downloadbash-6c20c8ed2cb9ab69a1a57ccb2b9b79969a808321.tar.xz
bash-6c20c8ed2cb9ab69a1a57ccb2b9b79969a808321.zip
Adding upstream version 5.2.15.upstream/5.2.15upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/getopts.right')
-rw-r--r--tests/getopts.right68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/getopts.right b/tests/getopts.right
new file mode 100644
index 0000000..599d830
--- /dev/null
+++ b/tests/getopts.right
@@ -0,0 +1,68 @@
+getopts: usage: getopts optstring name [arg ...]
+2
+getopts: usage: getopts optstring name [arg ...]
+2
+./getopts.tests: line 23: getopts: -a: invalid option
+getopts: usage: getopts optstring name [arg ...]
+-a specified
+-b bval specified
+remaining args: one two three
+-a specified
+-b bval specified
+remaining args: one two three four five six seven eight nine ten eleven twelve
+./getopts1.sub: option requires an argument -- b
+Usage: ./getopts1.sub [-a] [-b value] args
+-a specified
+-c cval specified
+-d specified
+-a specified
+-b 3 specified
+remaining args: one two three four five
+-a specified
+-b bval specified
+remaining args: one two three
+-a specified
+-b bval specified
+remaining args: one two three
+./getopts4.sub: error: option `b' requires an argument
+Usage: ./getopts4.sub [-a] [-b value] args
+./getopts4.sub: error: illegal option character `c'
+Usage: ./getopts4.sub [-a] [-b value] args
+-a specified
+remaining args: -b bval one two three
+OPTERR=0
+a here
+something else here
+OPTIND=3
+getop: OPTERR=1
+a here
+./getopts5.sub: illegal option -- c
+something else here
+./getopts5.sub: illegal option -- d
+something else here
+./getopts5.sub: illegal option -- e
+something else here
+getop: OPTIND=5
+OPTIND=3
+OPTERR=0
+-a specified
+remaining args:
+-a specified
+remaining args:
+-a specified
+remaining args:
+0
+./getopts7.sub: line 17: getopts: `opt-var': not a valid identifier
+remaining args:
+opt: x
+opt: y
+opt: a
+opt: b
+opt: c
+opt: z
+$1 = a
+./getopts10.sub: line 16: OPTARG: readonly variable
+OPTARG = x = ?
+unset x = ?
+declare -r RO="foo"
+declare -r RO="foo"