/[public]/getopt/trunk/getopt.1
ViewVC logotype

Diff of /getopt/trunk/getopt.1

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 324 Revision 365
1.TH GETOPT 1 "May 31, 1997" Linux "" 1.TH GETOPT "1" "June 2012" "Linux" "User Commands"
2.SH NAME 2.SH NAME
3getopt \- parse command options (enhanced) 3getopt \- parse command options (enhanced)
4.SH SYNOPSIS 4.SH SYNOPSIS
5.B getopt 5.BI getopt
6.I optstring parameters 6.I optstring parameters
7.br 7.br
8.B getopt 8.B getopt
9.RI [ options ] 9.RI [ options ]
10.RB [ \-\- ] 10.RB [ \-\- ]
19.I parameters 19.I parameters
20.SH DESCRIPTION 20.SH DESCRIPTION
21.B getopt 21.B getopt
22is used to break up 22is used to break up
23.RI ( parse ) 23.RI ( parse )
24options in command lines for easy parsing by 24options in command lines for easy parsing by shell procedures, and to
25shell procedures, and to check for legal options. 25check for legal options. It uses the
26It uses the
27.SM GNU 26.SM GNU
28.BR getopt (3) 27.BR getopt (3)
29routines to do this. 28routines to do this.
30 29.PP
31The parameters 30The parameters
32.B getopt 31.B getopt
33is called with can be divided into two parts: options 32is called with can be divided into two parts: options which modify
34which modify the way getopt will parse 33the way
34.B getopt
35will do the parsing
35.RI ( options 36.RI "(the " options
36and 37and the
37.BR \-o | \-\-options
38.I optstring 38.I optstring
39in the 39in the
40.BR SYNOPSIS ), 40.BR SYNOPSIS ),
41and the parameters which are to be 41and the parameters which are to be parsed
42parsed
43.RI ( parameters 42.RI ( parameters
44in the 43in the
45.BR SYNOPSIS ). 44.BR SYNOPSIS ).
46The second part will start at the first non\-option parameter 45The second part will start at the first non\-option parameter that is
47that is not an option argument, or after the first occurrence of 46not an option argument, or after the first occurrence of
48.RB ` \-\- '. 47.RB ' \-\- '.
49If no 48If no
50.RB ` \-o ' 49.RB ' \-o '
51or 50or
52.RB ` \-\-options ' 51.RB ' \-\-options '
53option is found in the first part, the first 52option is found in the first part, the first parameter of the second
54parameter of the second part is used as the short options string. 53part is used as the short options string.
55 54.PP
56If the environment variable 55If the environment variable
57.B GETOPT_COMPATIBLE 56.B GETOPT_COMPATIBLE
58is set, or if its first parameter 57is set, or if the first \fIparameter\fR is not an option (does not start
59is not an option (does not start with a 58with a
60.RB ` \- ', 59.RB ' \- ',
61this is the first format in the 60the first format in the
62.BR SYNOPSIS ), 61.BR SYNOPSIS ),
63.B getopt 62.B getopt
64will generate output that is compatible with that of other versions of 63will generate output that is compatible with that of other versions of
65.BR getopt (1). 64.BR getopt (1).
66It will still do parameter shuffling and recognize optional 65It will still do parameter shuffling and recognize optional arguments
67arguments (see section 66(see section
68.B COMPATIBILITY 67.B COMPATIBILITY
69for more information). 68for more information).
70 69.PP
71Traditional implementations of 70Traditional implementations of
72.BR getopt (1) 71.BR getopt (1)
73are unable to cope with whitespace and other (shell\-specific) special characters 72are unable to cope with whitespace and other (shell\-specific)
74in arguments and non\-option parameters. To solve this problem, this 73special characters in arguments and non\-option parameters. To solve
75implementation can generate 74this problem, this implementation can generate quoted output which
76quoted output which must once again be interpreted by the shell (usually 75must once again be interpreted by the shell (usually by using the
77by using the
78.B eval 76.B eval
79command). This has the effect of preserving those characters, but 77command). This has the effect of preserving those characters, but
80you must call 78you must call
81.B getopt 79.B getopt
82in a way that is no longer compatible with other versions (the second 80in a way that is no longer compatible with other versions (the second
83or third format in the 81or third format in the
84.BR SYNOPSIS ). 82.BR SYNOPSIS ).
89can be used. 87can be used.
90.SH OPTIONS 88.SH OPTIONS
91.TP 89.TP
92.BR \-a , " \-\-alternative" 90.BR \-a , " \-\-alternative"
93Allow long options to start with a single 91Allow long options to start with a single
94.RB ` \- '. 92.RB ' \- '.
95.TP 93.TP
96.BR \-h , " \-\-help" 94.BR \-h , " \-\-help"
97Output a small usage guide and exit successfully. No other output is generated. 95Display help text and exit. No other output is generated.
98.TP 96.TP
99.BR \-l , " \-\-longoptions \fIlongopts\fP" 97.BR \-l , " \-\-longoptions \fIlongopts\fP"
100The long (multi\-character) options to be recognized. 98The long (multi\-character) options to be recognized. More than one
101More than one option name
102may be specified at once, by separating the names with commas. This option 99option name may be specified at once, by separating the names with
103may be given more than once, the 100commas. This option may be given more than once, the
104.I longopts 101.I longopts
105are cumulative. 102are cumulative. Each long option name in
106Each long option name
107in
108.I longopts 103.I longopts
109may be followed by one colon to indicate it has a required argument, and by two colons to indicate it has an optional argument. 104may be followed by one colon to indicate it has a required argument,
105and by two colons to indicate it has an optional argument.
110.TP 106.TP
111.BR \-n , " \-\-name \fIprogname\fP" 107.BR \-n , " \-\-name \fIprogname\fP"
112The name that will be used by the 108The name that will be used by the
113.BR getopt (3) 109.BR getopt (3)
114routines when it reports errors. Note that errors of 110routines when it reports errors. Note that errors of
115.BR getopt (1) 111.BR getopt (1)
116are still reported as coming from getopt. 112are still reported as coming from getopt.
117.TP 113.TP
118.BR \-o , " \-\-options \fIshortopts\fP" 114.BR \-o , " \-\-options \fIshortopts\fP"
119The short (one\-character) options to be recognized. If this option is not 115The short (one\-character) options to be recognized. If this option
120found, the first parameter of 116is not found, the first parameter of
121.B getopt 117.B getopt
122that does not start with 118that does not start with a
123a
124.RB ` \- ' 119.RB ' \- '
125(and is not an option argument) is used as the short options string. 120(and is not an option argument) is used as the short options string.
126Each short option character 121Each short option character in
127in
128.I shortopts 122.I shortopts
129may be followed by one colon to indicate it has a required argument, 123may be followed by one colon to indicate it has a required argument,
130and by two colons to indicate it has an optional argument. 124and by two colons to indicate it has an optional argument. The first
131The first character of shortopts may be 125character of shortopts may be
132.RB ` + ' 126.RB ' + '
133or 127or
134.RB ` \- ' 128.RB ' \- '
135to influence the way
136options are parsed and output is generated (see section 129to influence the way options are parsed and output is generated (see
130section
137.B SCANNING MODES 131.B SCANNING MODES
138for details). 132for details).
139.TP 133.TP
140.BR \-q , " \-\-quiet" 134.BR \-q , " \-\-quiet"
141Disable error reporting by getopt(3). 135Disable error reporting by getopt(3).
142.TP 136.TP
143.BR \-Q , " \-\-quiet\-output" 137.BR \-Q , " \-\-quiet\-output"
144Do not generate normal output. Errors are still reported by 138Do not generate normal output. Errors are still reported by
145.BR getopt (3), 139.BR getopt (3),
146unless you also use 140unless you also use
147.IR \-q . 141.BR \-q .
148.TP 142.TP
149.BR \-s , " \-\-shell \fIshell\fP" 143.BR \-s , " \-\-shell \fIshell\fP"
150Set quoting conventions to those of shell. If no \-s argument is found, 144Set quoting conventions to those of \fIshell\fR.
151the 145If the \fB\-s\fR option is not given, the
152.SM BASH 146.SM BASH
153conventions are used. Valid arguments are currently 147conventions are used. Valid arguments are currently
154.RB ` sh ' 148.RB ' sh '
155.RB ` bash ', 149.RB ' bash ',
156.RB ` csh ', 150.RB ' csh ',
157and 151and
158.RB ` tcsh '. 152.RB ' tcsh '.
159.TP 153.TP
160.BR \-u , " \-\-unquoted" 154.BR \-u , " \-\-unquoted"
161Do not quote the output. Note that whitespace and special (shell\-dependent) 155Do not quote the output. Note that whitespace and special
162characters can cause havoc in this mode (like they do with other 156(shell\-dependent) characters can cause havoc in this mode (like they
157do with other
163.BR getopt (1) 158.BR getopt (1)
164implementations). 159implementations).
165.TP 160.TP
166.BR \-T , " \-\-test" 161.BR \-T , " \-\-test"
167Test if your 162Test if your
168.BR getopt (1) 163.BR getopt (1)
169is this enhanced version or an old version. This generates no output, 164is this enhanced version or an old version. This generates no
170and sets the error status to 4. Other implementations of 165output, and sets the error status to 4. Other implementations of
171.BR getopt (1), 166.BR getopt (1),
172and this version if the environment variable 167and this version if the environment variable
173.B GETOPT_COMPATIBLE 168.B GETOPT_COMPATIBLE
174is set, 169is set, will return
175will return
176.RB ` \-\- ' 170.RB ' \-\- '
177and error status 0. 171and error status 0.
178.TP 172.TP
179.BR \-V , " \-\-version" 173.BR \-V , " \-\-version"
180Output version information and exit successfully. No other output is generated. 174Display version information and exit. No other output is generated.
181.SH PARSING 175.SH PARSING
182This section specifies the format of the second part of the parameters of 176This section specifies the format of the second part of the
177parameters of
183.B getopt 178.B getopt
184(the 179(the
185.I parameters 180.I parameters
186in the 181in the
187.BR SYNOPSIS ). 182.BR SYNOPSIS ).
188The next section 183The next section
189.RB ( OUTPUT ) 184.RB ( OUTPUT )
190describes the output that is 185describes the output that is generated. These parameters were
191generated. These parameters were typically the parameters a shell function 186typically the parameters a shell function was called with. Care must
192was called with.
193Care must be taken that each parameter the shell function was 187be taken that each parameter the shell function was called with
194called with corresponds to exactly one parameter in the parameter list of 188corresponds to exactly one parameter in the parameter list of
195.B getopt 189.B getopt
196(see the 190(see the
197.BR EXAMPLES ). 191.BR EXAMPLES ).
198All parsing is done by the GNU 192All parsing is done by the GNU
199.BR getopt (3) 193.BR getopt (3)
200routines. 194routines.
201 195.PP
202The parameters are parsed from left to right. Each parameter is classified as a 196The parameters are parsed from left to right. Each parameter is
203short option, a long option, an argument to an option, 197classified as a short option, a long option, an argument to an
204or a non\-option parameter. 198option, or a non\-option parameter.
205 199.PP
206A simple short option is a 200A simple short option is a
207.RB ` \- ' 201.RB ' \- '
208followed by a short option character. If 202followed by a short option character. If the option has a required
209the option has a required argument, it may be written directly after the option 203argument, it may be written directly after the option character or as
210character or as the next parameter (ie. separated by whitespace on the 204the next parameter (i.e. separated by whitespace on the command
211command line). If the
212option has an optional argument, it must be written directly after the 205line). If the option has an optional argument, it must be written
213option character if present. 206directly after the option character if present.
214 207.PP
215It is possible to specify several short options after one 208It is possible to specify several short options after one
216.RB ` \- ', 209.RB ' \- ',
217as long as all (except possibly the last) do not have required or optional 210as long as all (except possibly the last) do not have required or
218arguments. 211optional arguments.
219 212.PP
220A long option normally begins with 213A long option normally begins with
221.RB ` \-\- ' 214.RB ' \-\- '
222followed by the long option name. 215followed by the long option name. If the option has a required
223If the option has a required argument, it may be written directly after 216argument, it may be written directly after the long option name,
224the long option name, separated by 217separated by
225.RB ` = ', 218.RB ' = ',
226or as the next argument (ie. separated by whitespace on the command line). 219or as the next argument (i.e. separated by whitespace on the command
227If the option has an optional argument, it must 220line). If the option has an optional argument, it must be written
228be written directly after the long option name, separated by 221directly after the long option name, separated by
229.RB ` = ', 222.RB ' = ',
230if present (if you add the 223if present (if you add the
231.RB ` = ' 224.RB ' = '
232but nothing behind it, it is interpreted 225but nothing behind it, it is interpreted as if no argument was
233as if no argument was present; this is a slight bug, see the 226present; this is a slight bug, see the
234.BR BUGS ). 227.BR BUGS ).
235Long options may be abbreviated, as long as the abbreviation is not 228Long options may be abbreviated, as long as the abbreviation is not
236ambiguous. 229ambiguous.
237 230.PP
238Each parameter not starting with a 231Each parameter not starting with a
239.RB ` \- ', 232.RB ' \- ',
240and not a required argument of 233and not a required argument of a previous option, is a non\-option
241a previous option, is a non\-option parameter. Each parameter after 234parameter. Each parameter after a
242a
243.RB ` \-\- ' 235.RB ' \-\- '
244parameter is always interpreted as a non\-option parameter. 236parameter is always interpreted as a non\-option parameter. If the
245If the environment variable 237environment variable
246.B POSIXLY_CORRECT 238.B POSIXLY_CORRECT
247is set, or if the short 239is set, or if the short option string started with a
248option string started with a
249.RB ` + ', 240.RB ' + ',
250all remaining parameters are interpreted 241all remaining parameters are interpreted as non\-option parameters as
251as non\-option parameters as soon as the first non\-option parameter is 242soon as the first non\-option parameter is found.
252found.
253.SH OUTPUT 243.SH OUTPUT
254Output is generated for each element described in the previous section. 244Output is generated for each element described in the previous
255Output is done 245section. Output is done in the same order as the elements are
256in the same order as the elements are specified in the input, except 246specified in the input, except for non\-option parameters. Output
257for non\-option parameters. Output can be done in 247can be done in
258.I compatible 248.I compatible
259.RI ( unquoted ) 249.RI ( unquoted )
260mode, or in such way that whitespace and other special characters within 250mode, or in such way that whitespace and other special characters
261arguments and non\-option parameters are preserved (see 251within arguments and non\-option parameters are preserved (see
262.BR QUOTING ). 252.BR QUOTING ).
263When the output is processed in the shell script, it will seem to be 253When the output is processed in the shell script, it will seem to be
264composed of distinct elements that can be processed one by one (by using the 254composed of distinct elements that can be processed one by one (by
265shift command in most shell languages). This is imperfect in unquoted mode, 255using the shift command in most shell languages). This is imperfect
266as elements can be split at unexpected places if they contain whitespace 256in unquoted mode, as elements can be split at unexpected places if
267or special characters. 257they contain whitespace or special characters.
268 258.PP
269If there are problems parsing the parameters, for example because a 259If there are problems parsing the parameters, for example because a
270required argument is not found or an option is not recognized, an error 260required argument is not found or an option is not recognized, an
271will be reported on stderr, there will be no output for the offending 261error will be reported on stderr, there will be no output for the
272element, and a non\-zero error status is returned. 262offending element, and a non\-zero error status is returned.
273 263.PP
274For a short option, a single 264For a short option, a single
275.RB ` \- ' 265.RB ' \- '
276and the option character are generated 266and the option character are generated as one parameter. If the
277as one parameter. If the option has an argument, the next 267option has an argument, the next parameter will be the argument. If
278parameter will be the argument. If the option takes an optional argument, 268the option takes an optional argument, but none was found, the next
279but none was found, the next parameter will be generated but be empty in 269parameter will be generated but be empty in quoting mode, but no
280quoting mode,
281but no second parameter will be generated in unquoted (compatible) mode. 270second parameter will be generated in unquoted (compatible) mode.
282Note that many other 271Note that many other
283.BR getopt (1) 272.BR getopt (1)
284implementations do not support optional arguments. 273implementations do not support optional arguments.
285 274.PP
286If several short options were specified after a single 275If several short options were specified after a single
287.RB ` \- ', 276.RB ' \- ',
288each will be present in the output as a separate parameter. 277each will be present in the output as a separate parameter.
289 278.PP
290For a long option, 279For a long option,
291.RB ` \-\- ' 280.RB ' \-\- '
292and the full option name are generated as one 281and the full option name are generated as one parameter. This is
293parameter. This is done regardless whether the option was abbreviated or 282done regardless whether the option was abbreviated or specified with
294specified with a single 283a single
295.RB ` \- ' 284.RB ' \- '
296in the input. Arguments are handled as with short options. 285in the input. Arguments are handled as with short options.
297 286.PP
298Normally, no non\-option parameters output is generated until all options 287Normally, no non\-option parameters output is generated until all
299and their arguments have been generated. Then 288options and their arguments have been generated. Then
300.RB ` \-\- ' 289.RB ' \-\- '
301is generated as a 290is generated as a single parameter, and after it the non\-option
302single parameter, and after it the non\-option parameters in the order 291parameters in the order they were found, each as a separate
303they were found, each as a separate parameter.
304Only if the first character of the short options string was a 292parameter. Only if the first character of the short options string
293was a
305.RB ` \- ', 294.RB ' \- ',
306non\-option parameter output is generated at the place they are found in the 295non\-option parameter output is generated at the place they are found
307input (this is not supported if the first format of the 296in the input (this is not supported if the first format of the
308.B SYNOPSIS 297.B SYNOPSIS
309is used; in that case all preceding occurrences of 298is used; in that case all preceding occurrences of
310.RB ` \- ' 299.RB ' \- '
311and 300and
312.RB ` + ' 301.RB ' + '
313are ignored). 302are ignored).
314.SH QUOTING 303.SH QUOTING
315In compatible mode, whitespace or 'special' characters in arguments or 304In compatible mode, whitespace or 'special' characters in arguments
316non\-option parameters are not handled correctly. As the output is 305or non\-option parameters are not handled correctly. As the output
317fed to the shell script, the script does not know how it is supposed to break 306is fed to the shell script, the script does not know how it is
318the output into separate parameters. To circumvent this 307supposed to break the output into separate parameters. To circumvent
319problem, this implementation offers quoting. The idea is that output 308this problem, this implementation offers quoting. The idea is that
320is generated with quotes around each parameter. When this output is once 309output is generated with quotes around each parameter. When this
321again fed to the shell (usually by a shell 310output is once again fed to the shell (usually by a shell
322.B eval 311.B eval
323command), it is split correctly into separate parameters. 312command), it is split correctly into separate parameters.
324 313.PP
325Quoting is not enabled if the environment variable 314Quoting is not enabled if the environment variable
326.B GETOPT_COMPATIBLE 315.B GETOPT_COMPATIBLE
327is set, if the first form of the 316is set, if the first form of the
328.B SYNOPSIS 317.B SYNOPSIS
329is used, or if the option 318is used, or if the option
330.RB ` \-u ' 319.RB ' \-u '
331is found. 320is found.
332 321.PP
333Different shells use different quoting conventions. You can use the 322Different shells use different quoting conventions. You can use the
334.RB ` \-s ' 323.RB ' \-s '
335option to select the shell you are using. The following shells are 324option to select the shell you are using. The following shells are
336currently supported: 325currently supported:
337.RB ` sh ', 326.RB ' sh ',
338.RB ` bash ', 327.RB ' bash ',
339.RB ` csh ' 328.RB ' csh '
340and 329and
341.RB ` tcsh '. 330.RB ' tcsh '.
342Actually, only two `flavors' are distinguished: sh\-like quoting conventions 331Actually, only two 'flavors' are distinguished: sh\-like quoting
343and csh\-like quoting conventions. Chances are that if you use another shell 332conventions and csh\-like quoting conventions. Chances are that if
344script language, one of these flavors can still be used. 333you use another shell script language, one of these flavors can still
345 334be used.
346.SH "SCANNING MODES" 335.SH "SCANNING MODES"
347The first character of the short options string may be a 336The first character of the short options string may be a
348.RB ` \- ' 337.RB ' \- '
349or a 338or a
350.RB ` + ' 339.RB ' + '
351to indicate a special scanning mode. If the first calling form 340to indicate a special scanning mode. If the first calling form in
352in the 341the
353.B SYNOPSIS 342.B SYNOPSIS
354is used they are ignored; the environment variable 343is used they are ignored; the environment variable
355.B POSIXLY_CORRECT 344.B POSIXLY_CORRECT
356is still examined, though. 345is still examined, though.
357 346.PP
358If the first character is 347If the first character is
359.RB ` + ', 348.RB ' + ',
360or if the environment variable 349or if the environment variable
361.B POSIXLY_CORRECT 350.B POSIXLY_CORRECT
362is set, parsing stops as soon as the first non\-option parameter 351is set, parsing stops as soon as the first non\-option parameter
363(ie. a parameter that does not start with a 352(i.e. a parameter that does not start with a
364.RB ` \- ') 353.RB ' \- ')
365is found that 354is found that is not an option argument. The remaining parameters
366is not an option argument. The remaining parameters are all interpreted as 355are all interpreted as non\-option parameters.
367non\-option parameters. 356.PP
368
369If the first character is a 357If the first character is a
370.RB ` \- ', 358.RB ' \- ',
371non\-option parameters are outputted at the place where they are found; in normal 359non\-option parameters are outputted at the place where they are
372operation, they are all collected at the end of output after a 360found; in normal operation, they are all collected at the end of
361output after a
373.RB ` \-\- ' 362.RB ' \-\- '
374parameter has been generated. Note that this 363parameter has been generated. Note that this
375.RB ` \-\- ' 364.RB ' \-\- '
376parameter is still generated, but it will always be the last parameter in 365parameter is still generated, but it will always be the last
377this mode. 366parameter in this mode.
378.SH COMPATIBILITY 367.SH COMPATIBILITY
379This version of 368This version of
380.BR getopt (1) 369.BR getopt (1)
381is written to be as compatible as possible to 370is written to be as compatible as possible to other versions.
382other versions. Usually you can just replace them with this version 371Usually you can just replace them with this version without any
383without any modifications, and with some advantages. 372modifications, and with some advantages.
384 373.PP
385If the first character of the first parameter of getopt is not a 374If the first character of the first parameter of getopt is not a
386.RB ` \- ', 375.RB ' \- ',
376.B getopt
387getopt goes into compatibility mode. It will interpret its first parameter as 377goes into compatibility mode. It will interpret its first
388the string of short options, and all other arguments will be parsed. It 378parameter as the string of short options, and all other arguments
389will still do parameter shuffling (ie. all non\-option parameters are outputted 379will be parsed. It will still do parameter shuffling (i.e. all
390at the end), unless the environment variable 380non\-option parameters are output at the end), unless the
381environment variable
391.B POSIXLY_CORRECT 382.B POSIXLY_CORRECT
392is set. 383is set.
393 384.PP
394The environment variable 385The environment variable
395.B GETOPT_COMPATIBLE 386.B GETOPT_COMPATIBLE
396forces 387forces
397.B getopt 388.B getopt
398into compatibility mode. Setting both this environment variable and 389into compatibility mode. Setting both this environment variable and
399.B POSIXLY_CORRECT 390.B POSIXLY_CORRECT
400offers 100% compatibility for `difficult' programs. Usually, though, 391offers 100% compatibility for 'difficult' programs. Usually, though,
401neither is needed. 392neither is needed.
402 393.PP
403In compatibility mode, leading 394In compatibility mode, leading
404.RB ` \- ' 395.RB ' \- '
405and 396and
406.RB ` + ' 397.RB ' + '
407characters in the short options string are ignored. 398characters in the short options string are ignored.
408.SH RETURN CODES 399.SH RETURN CODES
409.B getopt 400.B getopt
410returns error code 401returns error code
411.B 0 402.B 0
423.BR \-T . 414.BR \-T .
424.SH EXAMPLES 415.SH EXAMPLES
425Example scripts for (ba)sh and (t)csh are provided with the 416Example scripts for (ba)sh and (t)csh are provided with the
426.BR getopt (1) 417.BR getopt (1)
427distribution, and are optionally installed in 418distribution, and are optionally installed in
428.B /usr/local/share/getopt 419.BR /usr/local/share/getopt/
429or 420or
430.BR /usr/share/getopt . 421.BR /usr/share/getopt/ .
431
432.SH ENVIRONMENT 422.SH ENVIRONMENT
433.IP POSIXLY_CORRECT 423.IP POSIXLY_CORRECT
434This environment variable is examined by the 424This environment variable is examined by the
435.BR getopt (3) 425.BR getopt (3)
436routines.
437If it is set, parsing stops as soon as a parameter 426routines. If it is set, parsing stops as soon as a parameter is
438is found that is not an option or an option argument. All remaining 427found that is not an option or an option argument. All remaining
439parameters are also interpreted as non\-option parameters, regardless 428parameters are also interpreted as non\-option parameters, regardless
440whether they start with a 429whether they start with a
441.RB ` \- '. 430.RB ' \- '.
442.IP GETOPT_COMPATIBLE 431.IP GETOPT_COMPATIBLE
443Forces 432Forces
444.B getopt 433.B getopt
445to use the first calling format as specified in the 434to use the first calling format as specified in the
446.BR SYNOPSIS . 435.BR SYNOPSIS .
447.SH BUGS 436.SH BUGS
448.BR getopt (3) 437.BR getopt (3)
449can parse long options with optional arguments that are given an empty optional 438can parse long options with optional arguments that are given an
450argument (but can not do this for short options). This 439empty optional argument (but can not do this for short options).
440This
451.BR getopt (1) 441.BR getopt (1)
452treats optional arguments that are empty as if they were not present. 442treats optional arguments that are empty as if they were not present.
453 443.PP
454The syntax if you do not want any short option variables at all is 444The syntax if you do not want any short option variables at all is
455not very intuitive (you have to set them explicitly to the empty 445not very intuitive (you have to set them explicitly to the empty
456string). 446string).
457
458.SH AUTHOR 447.SH AUTHOR
459Frodo Looijaard <frodo@frodo.looijaard.name> 448.MT frodo@frodo.looijaard.name
449Frodo Looijaard
450.ME
460.SH "SEE ALSO" 451.SH "SEE ALSO"
461.BR getopt (3), 452.BR getopt (3),
462.BR bash (1), 453.BR bash (1),
463.BR tcsh (1). 454.BR tcsh (1).
464 455.SH AVAILABILITY
456You can download the latest getopt from
457.UR http://frodo.looijaard.name/project/getopt
458the author's home page
459.UE .
460It is also part of the util-linux package which is available from
461.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
462Linux Kernel Archive
463.UE .

Legend:
Removed from v.324  
changed lines
  Added in v.365

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26