Helpful Information
 
 
Category: Other Programming Languages
C Shell

So I'm writting a C shell script, part that gives me problems looks like something like this:


foreach count (1 2 3)
#some code
if ($count == 2) then
#some code
else
#some code
endif

I keep getting an error message if: badly fomred number.
What a heck is going on here? :chomp:

Thanks.

Is that your entire code? I ask because if it is, you're missing an "end" for your foreach loop. Besides that, I'm pretty much at a loss as well.

I suspect that the problem is in the code you aren't showing us. According to this page (http://bima.astro.umd.edu/checker/node29.html), the "badly formed number" error most often comes from trying to use a decimal fraction value; C-Shell only allows integers.










privacy (GDPR)