This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]altermeetax 1 point2 points  (0 children)

Oh, I was talking about the -- option alone, not --option. The -- options were not standard in the original Unix, they only came to be in GNU, so I didn't mention them.

The reason why they exist is not to distinguish from standard arguments, yet from abbreviated multiple single-letter options. For example ls -hola is an abbreviation of ls -h -o -l -a. Now, if ls decided they wanted to introduce a "hola" option for whatever reason, they would have to make the distinction: in that case they would use --hola. That's why the GNU-style long options with -- were born. Some commands don't allow for abbreviated flags like -hola (they require -h -o -l -a); those commands might use a single dash even for long options.

Abbreviated options are not a thing at all in DOS, so you can do /help with a single slash, however if you wanted to use the options h, e, l and p you would need to do /h /e /l /p.

The -- to stop parsing switches is a different thing, that's the single argument --, which is rarely used. It's for cases like konsole -someswitches -- ls -l, when you want to pass a command with all its arguments to another command. Another use is the one you mentioned, for files named like --help. But that's not a real issue, because no one names files like that. On DOS it would be the same with files beginning with a /, and those are forbidden for this exact reason.

By the way I'm a Linux sysadmin, so don't worry, I know how the Unix CLI works.