I have seen many tutorials that use a -- after commands. Something like this:
command -- What does this -- mean?
2 Answers
The -- is used to indicate the end of command line options. This enables you to use arguments starting with --. For example, if you create a file called --foo:
$ > '--foo'
$ ls
--fooAnd then try to delete it, rm will think you're giving it an argument:
$ rm --foo
rm: unrecognized option '--foo'
Try 'rm ./--foo' to remove the file '--foo'.
Try 'rm --help' for more information.One way around this is to use --:
$ rm -- --fooThis is common practice and recommended by POSIX, so it's supported by many programs.
2Most commands will use a -- to tell the command that further parameters should be treated differently. One example is the rm -- --filename noted above. Another example, a script like 'startx' will interpret itself everything before -- , and pass everything after it to the X server.