Path: utzoo!utgpu!attcan!uunet!husc6!mailrus!cornell!batcomputer!itsgw!imagine!rpics!hiebeler From: hiebeler@rpics (Dave Hiebeler) Newsgroups: comp.unix.questions Subject: Re: $< Message-ID: <1702@imagine.PAWL.RPI.EDU> Date: 10 Nov 88 03:58:45 GMT References: <1698@imagine.PAWL.RPI.EDU> Sender: news@imagine.PAWL.RPI.EDU Reply-To: hiebeler@turing.cs.rpi.edu (Dave Hiebeler) Organization: RPI CS Dept. Lines: 26 In article <1698@imagine.PAWL.RPI.EDU> tale@pawl.rpi.edu writes: >Okay, here's a segment of code that doesn't do exactly what everyone things >it should. It's for an csh-script. > >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 > I think you want your third line to read: if ( ${page[1]} == "q" ) exit (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.) I think your problem was the if was getting expanded to: if ( 5 plot == 'q' ) exit ---- Dave Hiebeler Internet: hiebeler@cs.rpi.edu (preferred address) R.D. Box 225A userfrzk%mts@itsgw.rpi.edu Chatham, NY 12037 Bitnet: userfrzk@rpitsmts.bitnet "xue zai xao" "...I can't remember what I was going to say..."