Ask Your Question
4

How can option processing be prevented after a command-line argument that is not an option?

asked 2023-06-24 16:11:49 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-06-24 16:31:01 +0000

ladyg gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-24 16:11:49 +0000

Seen: 8 times

Last updated: Jun 24 '23