Q: How to sum floats variables in bash? I am trying to run a script in which a variable is updated every time by a float number "given as user input" in a while loop. I know that bash doesn't support floats, I tried using | bc but it doesn't seem to work to me...
step_l0=0.25
step_l=0
while [ $step_l -le 2 ] do
  step_r=$radius_input
  while [ $step_r -le $radius_define ] do

    stuff done in the while loops

    step_r=$(( $step_r + $step_r0 ))
  done
  step_l=$(( $step_l + $step_l0 ))
done


A: Per chepner's suggestion -
$: a=0.25
$: b=1.753
$: awk "BEGIN{ print $a + $b }"
2.003
$: python -c "print $a + $b"
2.003
$: perl -e "print $a + $b"$'\n'
2.003

Where possible (and it's virtually always possible), if you need to invoke a more precise or powerful language to accomplish a task in your script, consider converting the entire script. You'll be glad you did.
