0

I need to fill an array and find out what the highest value is, which I've done. With this code:

full=($LASTOCT[*])
for i in $LASTOCT
do
    echo $i
done

echo "Highest value is: $(printf "%d\n" ${full[*]} | sort -n | tail -1) " 

My question is that no matter what number is in the last element of the array, I always get this error: ./ipcheck: line 16: printf: 134[*]: invalid number

Any ideas of what might be causing this? Thanks in advance!

4

1 回答 1

1

Change:

full=($LASTOCT[*])

to:

full=(${LASTOCT[*]})
于 2013-03-29T22:17:45.177 回答