Path: utzoo!utgpu!attcan!uunet!husc6!mailrus!cwjcc!hal!nic.MR.NET!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: $< Message-ID: <14464@mimsy.UUCP> Date: 10 Nov 88 11:53:46 GMT References: <1698@imagine.PAWL.RPI.EDU> <1702@imagine.PAWL.RPI.EDU> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 40 [apologies for all the quoting; I could not trim much out] >In article <1698@imagine.PAWL.RPI.EDU> tale@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@imagine.PAWL.RPI.EDU> hiebeler@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@mimsy.umd.edu Path: uunet!mimsy!chris