Bug (or wierd behavior) In C Shell

Fai Lau ugfailau at sunybcs.UUCP
Wed Jun 15 07:20:27 AEST 1988


In article <172 at applga.UUCP> simmons at applga.uucp (Steve Simmons) writes:
>Consider the following two scripts:
>
>       OK                        Buggy
>   #!/bin/csh           | #!/bin/csh
>   if ( 1 ) then        | if ( 0 ) then
>   cat << HERE          | cat << HERE
>   else                 | else
>   HERE                 | HERE
>   else                 | else
>   echo There           | echo There
>   endif                | endif
>Executing OK is fine -- it echos 'else'.  Executing Buggy gives an error
>	HERE: Command not found.
  ....
>The Bourne and Korn shell equivalents to this script work fine, ie, buggy.sh
>echos 'There'.  Bug in the C shell?  Or a wierdness of syntax that I can
>use to convince people Korn is better?  :-)

Try

#!/bin/csh
if (0) then
cat << HETE; else; HERE
else
echo There
endif

	I don't particularly like writing shell script for C shell for the
very reason that I can never tell what kind of "weirdness" would
pop up where I least expected it.

	Oh, BTW, in my personal opinion, I would say that the Korn shell is
"somewhat" better than the C shell. 

Fai Lau
SUNY at Buffalo (The Arctic Wonderland)
UU: ..{rutgers,ames}!sunybcs!ugfailau
BI: ugfailau at sunybcs INT: ugfailau at joey.cs.buffalo.EDU



More information about the Comp.unix.wizards mailing list