hello, I am trying to write a script so that when you enter 3 numbers it will give you the largest of them. When I run the script I get 2 errors, I can't figure out what is wrong so any help you could give me would be great! Thank you!
Enter three numbers and I will show you the largest of them >> \c
21
largest: line 9: test: : integer expression expected
largest: line 12: test: : integer expression expected
the largest number is
done
jawaibel@cis:~$ vi largest
1 #
2 #largest
3 #A sample program using the test command
4 #This program accepts three numbers and shos the largest of them
5 #
6 echo
7 echo "Enter three numbers and I will show you the largest of them >> \c"
8 read num1 num2 num3
9 if test "$num1" -gt "$num2" -a "$num1" -gt "$num3"
10 then
11 echo "the largest number is: $num1"
12 elif test "$num2" -gt "$num1" -a "$num2" -gt "$num3"
13 then
14 echo "the largest number is $num2"
15 else
16 echo "the largest number is $num3"
17 fi
18 echo "done"
19 echo
20 exit 0
~
~
~
"largest" 20L, 469C 12,1 All