-1

Possible Duplicate:
What does “--” (double-dash) mean?

There are many command line tools that take a single "--" argument. For example:

gem install mysql -- —–with-mysql-config=/usr/local/mysql/bin/mysql_config

It seems to be used as some kind of separator. Does it have a special meaning? Is it a commonly used idiom? If so, what's its purpose?

PS: I'm not talking about arguments of the form --argument, I'm talking about when you have a -- followed by white characters and other arguments.

  • 4
    That dup was already pointed out to you on your SU question. Why did you feel the need to repost here? – Mat Oct 20 '12 at 15:40

1 Answers1

0

-- is a convention that many programs honor. It means "ignore this argument, and treat all following words as command-line ARGUMENTS rather than command-line OPTIONS. Even if they begin with - or --."

For instance, if you have the misfortune to have a file named -f, how would you delete it? rm -f wouldn't work, because the -f is interpreted as an option to the rm command. But fortunately, the rm command honors the -- convention, so you can delete that file using:

rm -- -f
dubiousjim
  • 2,698