Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

What does "--" (double-dash) mean?

I have seen -- used in the compgen command.
For example:

compgen -W "foo bar baz" -- b


What is the meaning of the -- in there?
by

1 Answer

Kajalsi45d
More precisely, a double dash (--) is used in most Bash built-in commands and many other commands to signify the end of command options, after which only positional arguments are accepted.

Example use: Let's say you want to grep a file for the string -v - normally -v will be considered the option to reverse the matching meaning (only show lines that do not match), but with -- you can grep for the string -v like this:
grep -- -v file

Login / Signup to Answer the Question.