Skip to content

Comment on Ask HN: How do you search for "-42" in Google?

Comments

Similar question for command line options in unix. :)

In GNU tools at least (not sure if others follow this convention?), the option '--' indicates that subsequent parameters aren't to be interpreted as options. For example, this lets you cd into a directory named '-foo':

   cd -- -foo

This is a feature of GNU `getopt`, and I think it's supported by most BSD getopts. It's also recommended behavior by the SUS, see guideline 10: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_...

So it's not mandated, but it's the behavior of nearly all modern UNIX systems.

This is useful to know, and a great tip! I actually meant that "the OP question applies to searching for info about command line options as well". I find it amusing how your interpretation is equally valid. There is a lesson about clarity of communication here. :)

(also thanks for the reply, I appreciate it even tho it wasn't what I was looking for)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.