C-Shell Question

Tony J Yeates yeates at motcid.UUCP
Fri Nov 30 07:59:45 AEST 1990


athos at apple.com (Rick Eames) writes:

>I am having a problem with a shell script that really does nothing, but 
>won't work anyway.

>set x=1
>set y=10

>while ($x <=$y)
>     echo This does nothing.
>     @ x++
>end


>when I run this script, it tells me that it didn't expect an end of file, 
>and get's the error one line greater than the actual number of lines in 
>the file.

Don't know why it fails, but it does  in csh & tcsh .... usually!
If you do:

	csh <script name>

it works! (You need to add a space between the >= and the $y tho')

The fix is to add the shell selection line at the start, on the Sun I work
on, my first line is "#!/bin/csh -f". Works fine! (Again don't know why -
is it a bug, or are we missing something here?!)

I think you should prob. use @ x = 1 and @ y = 10, rather than "set" -
although it works without them.

This seems like a black art sometimes!



More information about the Comp.unix.shell mailing list