Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

marked as duplicate by manatwork, Mat, jw013, Renan, jasonwryan Oct 20 '12 at 18:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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 Answer 1

-- 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
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.