annotate tests/common.t @ 805:e18cc5fe828c

.shellcheckrc: disable SC2214 because is fires for all long options. Long options are not understood by shellcheck.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 04 Nov 2024 22:45:00 +0100
parents 2cd233b137ec
children 6cf3e1021862
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
803
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
1 Basic tests of common.subr
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
2
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
3 Shell is /bin/sh.
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
4
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
5
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
6 Setup
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
7 =====
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
8
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
9 $ set -u
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
10 $ . "${TESTDIR}/testsetup.sh"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
11 $ _p_datadir="${TESTDIR}/../share/local-bsdtools"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
12 $ . "${_p_datadir}/common.subr"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
13
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
14
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
15 Getopts
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
16 =======
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
17
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
18 Normal successfull calls
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
19
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
20 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
21 > opt_a=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
22 > opt_b=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
23 > unset opt_b_val
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
24 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
25 > while getopts "ab:-:" opt --long-a --long-b=value-of-b arg ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
26 > postprocess_getopts_for_long "ab:-:" opt "long-a" "long-b=" "" --long-b=value-of-b arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
27 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
28 > a|long-a) opt_a=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
29 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
30 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
31 > b|long-b) opt_b=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
32 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
33 > opt_b_val="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
34 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
35 > \?)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
36 > error=foo
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
37 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
38 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
39 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
40 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
41 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
42 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
43
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
44 $ checkyesno opt_a
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
45 $ checkyesno opt_b
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
46 $ [ "${opt_b_val}" = "value-of-b" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
47 $ [ -z "${error}" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
48
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
49 Not null-terminated long options speccifications
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
50
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
51 $ OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
52 > getopts "ab:-:" opt --long-a --long-b arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
53 > postprocess_getopts_for_long "ab:-:" opt "long-a" "long-b"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
54 /bin/sh: ERROR: Missing null terminator for long option specifications
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
55 [1]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
56 $ [ "${opt}" = '?' ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
57 $ [ -z "${OPTARG+SET}" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
58
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
59 Not null-terminated long options specs (alternate error handling)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
60
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
61 $ OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
62 > getopts ":ab:-:" opt --long-a --long-b arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
63 > postprocess_getopts_for_long ":ab:-:" opt "long-a" "long-b"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
64 [1]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
65 $ [ "${opt}" = ':' ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
66 $ [ -n "${OPTARG+SET}" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
67 $ [ -z "${OPTARG}" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
68
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
69 Illegal long option
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
70
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
71 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
72 > opt_a=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
73 > opt_b=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
74 > unset opt_b_val
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
75 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
76 > while getopts "ab:-:" opt --long-unknown ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
77 > postprocess_getopts_for_long "ab:-:" opt "long-a" "long-b=" "" --long-unknown
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
78 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
79 > a|long-a) opt_a=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
80 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
81 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
82 > b|long-b) opt_b=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
83 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
84 > opt_b_val="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
85 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
86 > \?)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
87 > error=foo
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
88 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
89 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
90 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
91 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
92 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
93 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
94 /bin/sh: ERROR: Illegal option --long-unknown
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
95 $ [ "${error}" = "foo" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
96
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
97 Illegal long option (alternate error handling)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
98
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
99 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
100 > opt_a=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
101 > opt_b=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
102 > unset opt_b_val
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
103 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
104 > while getopts ":ab:-:" opt --long-unknown ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
105 > postprocess_getopts_for_long ":ab:-:" opt "long-a" "long-b=" "" --long-unknown
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
106 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
107 > a|long-a) opt_a=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
108 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
109 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
110 > b|long-b) opt_b=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
111 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
112 > opt_b_val="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
113 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
114 > \?)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
115 > error="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
116 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
117 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
118 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
119 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
120 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
121 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
122 $ [ "${error}" = "long-unknown" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
123
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
124 Missing required option argument
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
125
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
126 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
127 > opt_a=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
128 > opt_b=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
129 > unset opt_b_val
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
130 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
131 > while getopts "ab:-:" opt --long-a --long-b arg ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
132 > postprocess_getopts_for_long "ab:-:" opt "long-a" "long-b=" "" --long-b arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
133 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
134 > a|long-a) opt_a=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
135 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
136 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
137 > b|long-b) opt_b=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
138 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
139 > opt_b_val="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
140 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
141 > ?)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
142 > error=foo
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
143 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
144 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
145 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
146 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
147 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
148 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
149 /bin/sh: ERROR: option argument required for option --long-b
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
150 $ [ "${error}" = "foo" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
151
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
152 Missing required option argument (alternate error handling)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
153
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
154 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
155 > opt_a=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
156 > opt_b=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
157 > unset opt_b_val
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
158 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
159 > while getopts ":ab:-:" opt --long-a --long-b arg ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
160 > postprocess_getopts_for_long ":ab:-:" opt "long-a" "long-b=" "" --long-b arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
161 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
162 > a|long-a) opt_a=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
163 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
164 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
165 > b|long-b) opt_b=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
166 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
167 > opt_b_val="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
168 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
169 > :)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
170 > error="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
171 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
172 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
173 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
174 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
175 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
176 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
177 $ [ "${error}" = "long-b" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
178
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
179 Option argument value not allowed
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
180
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
181 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
182 > opt_a=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
183 > opt_b=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
184 > unset opt_b_val
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
185 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
186 > while getopts "ab:-:" opt --long-a=a-value arg ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
187 > postprocess_getopts_for_long "ab:-:" opt "long-a" "long-b=" "" --long-a=a-value arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
188 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
189 > a|long-a) opt_a=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
190 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
191 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
192 > b|long-b) opt_b=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
193 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
194 > opt_b_val="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
195 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
196 > ?)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
197 > error=foo
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
198 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
199 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
200 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
201 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
202 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
203 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
204 /bin/sh: ERROR: no option argument allowed for option --long-a
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
205 $ [ "${error}" = "foo" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
206
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
207 Missing required option argument (alternate error handling)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
208
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
209 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
210 > opt_a=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
211 > opt_b=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
212 > unset opt_b_val
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
213 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
214 > while getopts ":ab:-:" opt --long-a=a-value arg ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
215 > postprocess_getopts_for_long ":ab:-:" opt "long-a" "long-b=" "" --long-a=a-value arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
216 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
217 > a|long-a) opt_a=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
218 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
219 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
220 > b|long-b) opt_b=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
221 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
222 > opt_b_val="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
223 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
224 > :)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
225 > error="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
226 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
227 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
228 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
229 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
230 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
231 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
232 $ [ "${error}" = "long-a" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
233
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
234 Invalid character in long option
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
235
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
236 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
237 > opt_a=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
238 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
239 > while getopts "ab:-:" opt --long=a ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
240 > postprocess_getopts_for_long "ab:-:" opt "long=a" "" --long=a arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
241 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
242 > a|long=a) opt_a=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
243 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
244 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
245 > \?)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
246 > error=foo
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
247 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
248 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
249 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
250 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
251 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
252 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
253 /bin/sh: ERROR: Long option specification contains a forbidden `=' character: long=a
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
254 $ [ "${error}" = "foo" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
255
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
256 Invalid character in long option (alternate error handling)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
257
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
258 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
259 > opt_a=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
260 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
261 > while getopts ":a-:" opt --long=a ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
262 > postprocess_getopts_for_long ":a-:" opt "long=a" "" --long=a arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
263 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
264 > a|long=a) opt_a=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
265 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
266 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
267 > \?)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
268 > error="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
269 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
270 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
271 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
272 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
273 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
274 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
275 $ [ "${error}" = "long=a" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
276
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
277 Invalid character in long option
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
278
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
279 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
280 > opt_b=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
281 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
282 > while getopts "b:-:" opt --long=a ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
283 > postprocess_getopts_for_long "b:-:" opt "long=b=" "" --long=b=value arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
284 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
285 > b|long=b) opt_b=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
286 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
287 > \?)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
288 > error=foo
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
289 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
290 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
291 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
292 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
293 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
294 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
295 /bin/sh: ERROR: Long option specification contains a forbidden `=' character: long=b=
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
296 $ [ "${error}" = "foo" ]
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
297
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
298 Invalid character in long option (alternate error handling)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
299
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
300 $ error=''
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
301 > opt_b=no
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
302 > OPTIND=1
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
303 > while getopts ":b:-:" opt --long=a ; do
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
304 > postprocess_getopts_for_long ":b:-:" opt "long=b=" "" --long=b=value arg
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
305 > case "$opt" in
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
306 > b|long=b) opt_b=yes
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
307 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
308 > \?)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
309 > error="${OPTARG}"
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
310 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
311 > *)
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
312 > error=bar
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
313 > ;;
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
314 > esac
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
315 > done
2cd233b137ec common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
316 $ [ "${error}" = "long=b=" ]