csh arithmetic ?

Hello,

Could someone explain how this one is possible:

# @ x = 10 - 11 + 3
# echo $x
-4

I know that writing script using csh is bad idea, but I need to write few lines.

thanks
Vilius

Not sure, but csh must be evaluating from right to left in which case 11+3 is calculated first and the 10 - result. something similar to this.

 
@ x = 10 - (11 + 3)

Hi.

I think:

@ x = (10 - 11) + 3

gives the right result.

Csh Programming Considered Harmful

Top 10 Reasons not to use the C Shell