command line options

Barry Shein bzs at bu-cs.BU.EDU
Tue Apr 12 09:29:48 AEST 1988



>How about:
>
>	usage command
>
>This is guaranteed to work no matter what the command usage is
>and only requires the addition of a new command.  If someone is
>competent enough to type -usage then this should be just as easy.
>It even takes fewer characters to type than command -usage.
>
>Seriously, the -= sounds like a good idea, I'm going to use it
>until something better comes along.
>-- 
>Larry Cipriani, AT&T Network Systems and Ohio State University

Actually, that's not a bad idea at all, it could be a sort of mutant
merger of "which" and "what", that is the function of "which" (or
hell, could just use which, that's what it's there for) to track down
the command path and a version of "what" to track down some pattern
other than "@(#)", heck, how about an option to "what" which (no
quotes) just specifies an alternate pattern, like "@(U)" or something,
and call the whole mess "how", then it would just be equivalent to
something like:

	how() {
		for i
		do
			what -p '@(U)' `which $i`
		done
	}

Hmm, pretty similar to:

	how() {
		for i
		do
			strings `which $i` | grep '@(U)'
		done
	}

For systems with "strings". I suppose one could substitute the path
for the user by replacing a first %s with the command name:

	how() {
		for i
		do
			strings `which $i` | grep '@(U)' | sed "s/%s/$i/"
		done
	}

As a matter of fact, I wonder how badly this would work without
any changes:

	how() {
		for i
		do
			strings `which $i` | grep '[Uu]sage:' | sed "s/%s/$i/"
		done
	}

or its moral equivalent, or similarly if 'what' took a prefix arg then
"what -p 'Usage:'" might do the job, tho some programs seem to use
"usage:".

who's on first, how ever.

	-Barry Shein, Boston University



More information about the Comp.unix.wizards mailing list