I do not understand what is happening here, based on Convert string into integer in bash script - "Leading Zero" number error, I am able to convert the string into integer. I can even do addition. However, when I compare the numbers it gives me the wrong comparison. Refer to example below
Here's an example
array=(02 08 10 11 23 52)
for i in 0 1 2 3 4 5
do
if [[ ${array[i]#0} > 15 ]]
then
echo "${array[i]#0} is greater than 15"
else
echo "${array[i]#0} is less than 15"
fi
done
Output
2 is greater than 15
8 is greater than 15
10 is less than 15
11 is less than 15
23 is greater than 15
52 is greater than 15