1

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

What does '--' (two dashes) mean with association to Linux files and directories.

I've found something else but not too sure if it is correct and relates to the same thing. "Another convention is to use '--' (two dashes) to indicate the end of flags, and the beginning of file names."

Dle1990
  • 11
  • 1
    There is no association to files and directories. It is a signal when providing arguments to commands that you are done supplying options / arguments, and are listing a 'target' of some kind, either a file or a directory maybe. Can you show an example of what you are trying to do? – vgoff Nov 17 '12 at 01:35
  • On my browser it looks like you are referring to single - but the words you are both using are more accurate descriptions of --. – dubiousjim Nov 17 '12 at 01:46
  • I thought the same thing, but too small an edit, so I just answered with the assumption. Hopefully they will edit it if it is incorrect. – vgoff Nov 17 '12 at 02:47
  • 1
    Well, - has a meaning too when used as a filename (it typically means stdin/stdout), but the second paragraph is clearly talking about --, so I'm not sure which he actually wants – Michael Mrozek Nov 17 '12 at 03:07

1 Answers1

3

I'm not sure if you mean - or --, so here's some information about both:

- is a shorthand that some programs accept to refer to STDIN, the standard input of the program. That is, in a pipeline like echo foo | cat - (although - is actually unnecessary in this instance), cat receives "foo" and a newline as its input from STDIN.

-- indicates the end of arguments. In programs that deal with files, this often means that what follows will only be filenames, and not, say, command-line options. In such an instance it is used to try and get around filenames that look like options (for example, if you have a file named -e and an the program also accepts a -e argument). Another way to get around this is to do something like command ./-e, which is actually more compatible across programs as it doesn't require the underlying program to implement handling --.

Chris Down
  • 125,559
  • 25
  • 270
  • 266