Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One way to prevent option processing after a command-line argument that is not an option is to use a double hyphen "--" before the non-option argument. This tells the command-line interpreter that any subsequent arguments should be treated as non-options, even if they begin with a hyphen.

For example, in the command:

$ command --option1 --option2 file.txt

the double hyphen tells the interpreter to treat "file.txt" as a non-option, even though it does not begin with a hyphen. The command will process the options "--option1" and "--option2" but will not attempt to interpret "file.txt" as an option.