I have a array:
ARRAY=(12.5 6.2)
I wish to return the maximum value in ARRAY which Output is 12.5
Anyone can share me ideas?
I have try this:
max=0
for v in ${ARRAY[@]}; do
if (( $v > $max )); then max=$v; fi;
done
echo $max
But it return me:
((: 12.5 > 0 : syntax error: invalid arithmetic operator (error token is ".5 > 0 ")
((: 6.2 > 0 : syntax error: invalid arithmetic operator (error token is ".2 > 0 ")
printf ${(On)ARRAY}. Example