6

Maximum number from input by user

view full story
linux-howto

http://www.unix.com – I am trying to calculate the maximum number from four numbers input by the user. I have the following code, but it does not work. It says there's an error with the last line "done". Any help would be appreciated. Code: max=0 echo "Please enter four numbers: " for i in 1 2 3 4 do read number max=`expr $max + $number` if [ $number -gt $max ] done Moderator's Comments: Please use code tags (HowTos)