[net.unix] + - and = in option strings

brad@looking.UUCP (Brad Templeton) (03/19/84)

I am surprised all this debate didn't go on when I posted the
"Waterloo Command Syntax Philosophy" to this group back in the beginning.
Around here the rule is "+" turns on an option and "-" turns it off.
Options without boolean values are set by option=value or option="value"
(for strings) or option=value,value,value...

They have an almost 100% rule that options are valid anywhere on
the command line, and that unflagged operands are always the same type
of thing.  (ie. no grep string filename, it is grep "string" filename
or grep Pattern=string filename)

There was a lot of feeling that using +option and -option would be
a real pain because most options are turned on and + is a shifted character
on most terminals.

But... lo and behold when the switch was made, there was almost no complaint,
and everybody got used to it quite quickly.  You would be amazed at how
quickly people will adapt to this kind of thing.  But after all, many
common characters are shifted, like ", ' (on some) > and <, as well as
$ and many other shell metacharacters.  Hell, some systems have # for
a delete character (shifted) and multics people like using ">" as a
path character (unix slash equivalent) so people will use anything and
get used to it quickly.

In fact, these days I can't see any good reason except momentum for
unix not to switch over to a consistent, easy to learn syntax.
It can be done slowly, since as I pointed out previously, unix has no
standard or solid custom.  Why not write all new commands with a new
syntax.  We have library routines at Waterloo that make parsing command
lines of this form simple.
-- 
	Brad Templeton - Waterloo, Ontario (519) 886-7304

tim@unc.UUCP (Tim Maroney) (03/19/84)

While we're on the subject of command-line syntax:

Has anyone else noted that 4.2bsd uses the pound sign ("#") as an option to
several commands, for instance, lpr(1)?  How dumb can you get?  Both csh and
sh scripts will consider the pound sign to begin a comment, so not only will
your "#" option get zapped, so will all other options after it the line, and
the program will probably interpret the "-" left over as meaning to use the
standard input as an input file argument.

I was really surprised to see this silliness in what is supposedly a
production-quality project written by people experienced with UNIX (which is
[repeat after me] a trademark of Bell Labs [or whatever it's called now]).
--
Tim Maroney, The Censored Hacker
mcnc!unc!tim (USENET), tim.unc@csnet-relay (ARPA)

All opinions expressed herein are completely my own, so don't go assuming
that anyone else at UNC feels the same way.

gwyn@brl-vgr.ARPA (Doug Gwyn ) (03/20/84)

In the Bourne shell at least,

	cc -# stuff...

not only works but is useful when I'm working on new versions of "cc".
This use of # does not indicate a comment (see sh(1)).