$<

Chris Torek chris at mimsy.UUCP
Thu Nov 10 21:53:46 AEST 1988


[apologies for all the quoting; I could not trim much out]
>In article <1698 at imagine.PAWL.RPI.EDU> tale at pawl.rpi.edu writes:
>>set page = $<
>>echo $page $#page		/* just for debugging
>>if ( $page == 'q' ) exit
>>man $page | less
>>
>>If I give it '5 plot', it does:
>>5 plot 1
>>if: expression syntax
>>child of tty exited with return code 1

In article <1702 at imagine.PAWL.RPI.EDU> hiebeler at rpics (Dave Hiebeler) writes:
>  I think you want your third line to read:
>if ( ${page[1]} == "q" ) exit

This still fails.

>  (Note that just out of habit I use {} around variable-names, and double
>quotes around strings... you probably don't need them, but I'm not sure.)

You need the quotes, but not where you put them:

>  I think your problem was the if was getting expanded to:
>    if ( 5 plot == 'q' ) exit

This is exactly the problem; to circumvent it, use

	if ("$page" == q) exit

or

	if ($page:q == q) exit

It is not necessary to quote the `q' that comes after the `==' in
this case, since it contains no special characters.  (It does not
hurt to quote it, of course.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.questions mailing list