How to get the C-shell to recognize -?

Ken Turkowski ken at turtlevax.UUCP
Tue May 14 01:53:42 AEST 1985


An the winner is:
Paul Richards	University of Illinois at Urbana-Champaign, Dept of Comp Sci
uiucdcs!richards

	switch ("$flag")
		case '-[?]':
			<cmds>
			breaksw
		case '-a':
			<othercmds>
			...
	endsw

This is the only correct entry so far.  Other entries matched -a as well as -?.
One entry had the gall to have the csh invoke a Bourne shell script (is there
no ethnic pride?!).  This version matches -? only,using no other than the csh.
I'd still be interested in any other approaches that work.

But imagine that!  Using brackets for quotes!  Who would have ever thought that
the C-shell, with its infinitely helpful programmer-oriented features, has this
level of protection against matching metacharacters!	:-)	:*S

Here's the essence of the original posting:
> In trying to make my shell scripts understand a standard help inquiry,
> I would like to have the csh recognize the flag "-?" , so that one might say:
> 	gobble -\?
> and have it echo:
> 	gobble takes the flags:
> 	-v		Verbose
> 	-o <outfile>	Output is directed to <outfile> rather than the default
> 	-?		Prints this help message
> 	...
-- 

Ken Turkowski @ CADLINC, Menlo Park, CA
UUCP: {amd,decwrl,hplabs,nsc,seismo,spar}!turtlevax!ken
ARPA: turtlevax!ken at DECWRL.ARPA



More information about the Comp.unix mailing list