Is there a certain syntax to use while using fractions or decimals in a bash script?
I tried using the following script:
#!/bin/bash
{
n=9
echo "$n"
for (( i=.5; $i <10; i++ ));
do
let "c=$i+1"
echo $i "+" $c
done
}
This works with i=1, but it generates a syntax error when I put .5.
Is there also a way to go by increments of 0.5 in the loop?
Thank you!
bashdoes not implement floating-point arithmetic.