interesting csh bug

Patel ashesh at adiron.UUCP
Sat Oct 7 04:34:43 AEST 1989


In article <9563 at cadnetix.COM>, rusty at cadnetix.COM (Rusty Carruth) writes:
> In article <9557 at cadnetix.COM> rusty at cadnetix.COM (Rusty Carruth) (thats me)
> writes:
> >
> >However, I had been noticing some strange behavior, and finally
> >got the time to track it down.  Here is a small test case
> >which embodies my findings:
> >
> ....
> >#! /bin/csh
> ....
> >      if( $SET == "set1" ) then
> ....
> >	    if( 3 != 3) then
> 
> Well, I've already gotten mail from 2 people pointing out that
> csh will fail to 'do the good thing' if you use "if(", but
> it will work just fine and dandy if you use "if (".  And
> they were right, it works just great if you have a space
> after the if.  My thanks to David C Lawrence <uunet!pawl.rpi.edu!tale>
> and Bradley White <uunet!mtxinu.com!bww> for pointing this out.
> 
> Thus ends the saga.  If any wizards out there want a copy of my
> un-news script, email me (it takes news articles which have been saved 
> away and un-shars or un-uudecodes them into another location, and handles
> both multiple-part articles and single articles.  It does not as
> of yet handle patches, and probably never will).
> ---------- 
> Rusty Carruth  UUCP:{uunet,boulder}!cadnetix!rusty  DOMAIN: rusty at cadnetix.com
> Daisy/Cadnetix Corp. (303) 444-8075\  5775 Flatiron Pkwy. \ Boulder, Co 80301
> Radio: N7IKQ    'home': P.O.B. 461 \  Lafayette, CO 80026


Interesting........ I never had that problem and I would assume that
something else could be wrong in the shell script that you wrote. My
suggestion would be to "debug" the script using -xv flags; i.e.
the first line of the program would be

#!/bin/csh -xv

(4.3 BSD manual discusses this flags.) Also I think that in the example 
above it might be appropriate to use ' ~= ' for pattern matching instead
of ' == ' which is used in expressions. Chap-7 in the text-book about
C-shell discusses this. 



More information about the Comp.unix.wizards mailing list