How to get the C-shell to recognize -?

VLD/ATB jra at BRL-VAT.ARPA
Mon May 13 23:11:25 AEST 1985


>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
>	...
>I have done this easily with sh, but csh is very stubborn.  I have tried
>	switch ("$flag")
>		case
>		case -?:
>		case '-?':
>		case -\?:
>		case "-?":
		.
		.
		.
>	endsw
>and none of them will match.  So I offer this problem as a puzzle to the
>Unix community (including Bill Joy, the author).
>-- 

Try this:
	set noglob
	switch ( $FLAG )
		case "-?":
			.
			.
			.
	endsw
	unset noglob



More information about the Comp.unix mailing list