I am trying to add a floating point number to the looping points. My loop is non sequential.
j=9.46
for i in 8.0 7.5 7.0 6.5 ;do
$i = $i + $j |bc
echo '$i'
i also tried
ans=$(( x + y ))
k=$[$i+$j]
i have to add the constant to the looping index and use it in a command later in the script. I am able to echo the output using |bc but can't use it in the script as a variable later.
|bc". Then it will be easy to store the result in a variable. Hint: post your code at shellcheck.net to find errors