I'm trying to calculate some float numbers in shell with these commands:
zmin='0.004633'
zmax='3.00642'
step='0.1'
echo "zmin=$zmin"
echo "zmax=$zmax"
echo "step=$step"
n=`echo "(($zmax - $zmin)) / $step " |bc -l `
b=${n/\.*}
echo "b=$b"
for ((j = 1; j <= b; j++))
do
z_$j=`echo "scale=7; (($zmin + $(($j-1)))) * $step" |bc -l`
zup_$j=`echo "scale=7; $((z_$j)) + $step " |bc -l `
echo "z_$j=$((z_$j)) && zup_$j=$((zup_$j))"
done
but I just receive the correct answer for n. For z_$j & zup_$j I'm receiving this error:
'z_9=.8004633: command not found'
How I can solve this problem?