Skip to content

Latest commit

 

History

History
17 lines (10 loc) · 886 Bytes

--.md

File metadata and controls

17 lines (10 loc) · 886 Bytes

Using -- as a Command Line Argument

When you use -- as a command line argument, it specifies that all the following arguments should get passed to whatever's running.

In other words, when the shell sees --, it knows that everything that comes after should be treated as an argument for the command, not an option.

This is notable because, usually, anything in the command that starts with a - gets treated as an option. But if you use --, you can pass in arguments even if they start with -.

Example

I have my Node project set up to run my linter when I use the command:

$ npm run lint

If I want to run my linter with the --fix argument, then I could pass this argument to my Node command using the same script with the -- argument:

$ npm run lint -- --fix

This will pass --fix as an additional argument to the same script that normally runs my linter!