When I try following statements, it doesn't assign values properly to variables and loop goes infinite-
while ( [ $nos -ne 0 ] )
do
    rem = `expr $nos % 10`
    sum = `expr $sum + $rem`
    nos = `expr $nos / 10`
done
But when I remove spaces from left and right side of assignment operator, it works fine. Like this -
while ( [ $nos -ne 0 ] )
do
    rem=`expr $nos % 10`
    sum=`expr $sum + $rem`
    nos=`expr $nos / 10`
done
Why the Shell behaviour is like that?
 
     
    