shell 中的 if-elif-else 语句使用实例
1 #!/bin/sh
2 #shellThird.sh
3 # to show the method of if
4 echo -n "Enter the first integer:"
5 read First
6 echo -n "Enter the second integer:"
7 read Second
8 if [ "$First" -gt "$Second" ]
9 then
10 echo "$First is greater than $Second"
11 elif [ "$Second" -gt "$First" ]
12 then
13 echo "$Second is greater than $First"
14 else
15 echo "$First is equal to $Second"
16 fi