File: getopts.right

package info (click to toggle)
bash 5.3-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 43,860 kB
  • sloc: ansic: 134,738; sh: 8,866; yacc: 5,966; makefile: 4,697; perl: 4,105; asm: 48; awk: 23; sed: 16
file content (70 lines) | stat: -rw-r--r-- 1,610 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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"
./getopts10.sub: line 33: V: readonly variable
1