When i run
while [ $p \< 1 ]
p=$(echo "scale=2; $p*$k" | bc)
i have this result
What can i do to have 0.1, 0.2, 0.4 and 0.8 ?
I have the following script on Ubuntu 14.04.1 LTS 64-bit bash command prompt:
DIFF=`echo "scale=3; $F - $S" | bc -l`
df=`echo "scale=3; $DIFF / $N" | bc -l`
is=`echo "scale=3; $S / $df" | bc -l`
if=`echo "scale=3; $F / $df" | bc -l`
for i in `seq 0 $N`
f=`echo "scale=3; $S + $i * $df" | bc -l | awk ' sub("\\.*0+$","") '`
My search this morning was about how could I compare two decimal numbers in bash, and I came to this answser: How to compare to floating point number in a shell script.