I'd like to generate a sequence of equally spaced decimal numbers.
For example, I want to echo
all numbers between 3.0
and 4.5
, with step 0.1
. I tried $ for i {3.0..4.5..0.1}; do echo $i; done
, but this gives an error.
I also tried $ for i in $(seq 3.0 4.5 0.1); do echo $i; done
but nothing happens.
Copyright Notice:Content Author:「izxle」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30768644/how-to-loop-through-a-range-of-decimal-numbers-in-bash