Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
dict:terms:end_of_options [2011/03/20 08:43] thebonsai [End of Options] |
dict:terms:end_of_options [2020/01/02 16:12] ftheile Fix a typo |
||
---|---|---|---|
Line 5: | Line 5: | ||
This is problematic when a non-option argument has to be specified that begins with a dash. A common example for this are filenames. | This is problematic when a non-option argument has to be specified that begins with a dash. A common example for this are filenames. | ||
- | Many utilities use the convention to specify two consecutive dashes (''<nowiki>--</nowiki>'') to signal "end of options at this point". Beyond this tag, no options are are processed anymore, even if an argument begins with a dash. | + | Many utilities use the convention to specify two consecutive dashes (''<nowiki>--</nowiki>'') to signal "end of options at this point". Beyond this tag, no options are processed anymore, even if an argument begins with a dash. |
Example: You want to list (''ls'') the file with the name ''-hello''. With common option processing, this could end up in the ls-options ''-h'', ''-e'', ''-l'' and ''-o'' and probably in an error message about invalid options. You use this to avoid the wrong option processing: | Example: You want to list (''ls'') the file with the name ''-hello''. With common option processing, this could end up in the ls-options ''-h'', ''-e'', ''-l'' and ''-o'' and probably in an error message about invalid options. You use this to avoid the wrong option processing: | ||
<code> | <code> | ||
- | ls -- hello | + | ls -- -hello |
</code> | </code> | ||
Line 17: | Line 17: | ||
===== See also ===== | ===== See also ===== | ||
+ | |||
+ | * Scripting article, internal: [[howto:getopts_tutorial]] | ||