Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!brutus.cs.uiuc.edu!psuvax1!psuvm!cunyvm!ndsuvm1!mtus5!bacon From: BACON@MTUS5.BITNET (Jeffery Bacon) Newsgroups: comp.unix.questions Subject: How is && supposed to work in csh? Message-ID: <89293.143521BACON@MTUS5.BITNET> Date: 20 Oct 89 19:35:21 GMT Organization: Computing Technology Services, Michigan Technological Univ. Lines: 29 (This is also a test to see whether this new netnews server I just put in blows up or not.) I have the following chunk of code on a Sun 3 running SOS 4.0.3... if ( -f /bin/sun4 ) /bin/sun4 && set arch=sun4 && goto gotarch if ( -f /bin/sun4c ) /bin/sun4c && set arch=sun4 && goto gotarch if ( -f /bin/sun3 ) /bin/sun3 && set arch=sun3 && goto gotarch if ( -f /bin/sun3x ) /bin/sun3x && set arch=sun3 && goto gotarch gotarch: The idea here is to implement a cheap 'arch' cmd inside my script instead of having to start another shell (by running 'arch'). But, on SOS 4.0.3 for 68020's, there is no /bin/sun4c. So of course that if comes back false. What I would expect is that the shell would go on to the next line (i.e. go look for /bin/sun3). Instead, it only skips the /bin/sun4c cmd and goes ahead and executes the rest of the line! Is this normal? I thought that if you use an 'if () cmd' construct, it would take the rest of the line...? Or is it treating the '&&' as the end-of-line? Would someone be kind enough to explain? I've RTFM'ed and RTF(C-Shell Field Guide)'ed; neither were very explicit, and there are no gurus to ask because I'm supposedly one of them. (We're not unix-literate here.) Thanks. ------- Jeffery Bacon Computing Technology Svcs., Michigan Technological University bitnet: bacon@mtus5 uucp (alternate): !rutgers!clip!anet!bacos