Division Error - Integer Error?

Hi All,

I'm reasonably new to UNIX, and am having problems with a TSHELL script that I am using. The script is intended to cycle through a loop, and then divide the number in the counter by 10 and store the result in another variable. I am missing something simple here, but cannot work it out :confused: Can anyone offer any suggestions? Here is the code:

@ i = 1
while ($i <= 5)
@ j = ($i / 10)
@ i = $i + 1
end

I suspect an integer division problem, since if i = 1 then j = 0 . But....if i = 10 then then j = 1. If i = 1.3 then j = 0 again.

Thank you.

try using awk to divide

j=`awk 'BEGIN{print '$i'/10'}`