count=$#

args=("$@")

max=$1

while [ $count -gt 0 ]

do

num=${args[count]}

if test num -gt max

then

let max=num

let count=count-1

fi

done

echo "The largest number is $max"

echo "Done"

exit 0

what I am trying to do is set the first number entered into max then go through the array each time assigning the value to num, then I want to test the value in num to see if its greater then max and if it is then that value will take over the max value. For example say I enter ./largest 50 10 6 90. max will be set at 50 then num would be set to whatever is in array 4 which would be 90. Then is will see if num(90) is greater then max(50) and since it is max will become 90. then it will go down the list so num will become the next array which is 6 and do the same test and since 6 isnt greater than 50 max will remain as 50. So it will do this for all the numbers and the largest number will be in max. Then "echo "The largest number is $max"" will print out the largest number. Seems like it should work but it keeps saying "./sum line 8: test: num: integer expression expected" no clue what to do. Please help.vi