Hey I am trying to return a list of values based on a certain criteria but the bash output is unexpected.
oneIter=80.50
halfIter=40.25
twoIter=45.08
threeIter=36.22
numArr=()
posArr=()
#Creating an array of numbers starting from 0 to 81 with a step size of 0.01
for x in $(seq 0 0.01 81); do numArr+=(${x}); done
#Iterating through numArr and adding values to posArr if they satisfy condition
for x in ${numArr[@]}; do
if [[ ${x} < ${oneIter} && ${x} > ${halfIter} && ${x} < ${twoIter} /
&& ${x} > ${threeIter} ]]; then
posArr+=(${x})
fi
done
for x in ${possArr[@]}; do echo $x; done
The last line code returns the values in the possArr array. But the values for some reason include starting from 4.03, 4.04, 4.05, ..., 4.50 and then after 4.50 the actual values that satisfy the condition are listed 40.26,40.27,...45.07. My question is why does the possArr include the 4.03 - 4.50 values when they clearly break the condition? Thank you.