command line options

Alan J Rosenthal flaps at utcsri.UUCP
Mon Apr 11 16:09:32 AEST 1988


Suppose you have a command, and it has a -h option which takes a
filename argument, as in "command -h file".  This is certainly
reasonable.

Suppose you have a file in your current directory named `elp'.
This is not a weird file name.

Suppose you therefore invoke the command as "command -h elp" or
"command -help".  Amusing, but syntactically correct.

In article <21419 at bu-cs.BU.EDU> bzs at bu-cs.BU.EDU (Barry Shein) writes:
>What's wrong with using "-help" as a special case?

This.  The above command, although it worked fine for files `ela'
through `elo', doesn't work for `elp'.

In general, unix options are too terse to be likely to have a syntactic
hole large enough to put a whole word through.  We should be grateful
that the implementation of getopt() guarantees (accidently, I'm sure)
that "command '-?'" works.

ajr

--
"Don't put things you find on the street into your mouth."



More information about the Comp.unix.wizards mailing list