sqtsqt 发表于 2018-8-29 09:40:54

Linux-shell之判断大小

# cat test21.sh  
#!/bin/bash
  
cat /dev/null
  
RE_B=$?
  
if [ $RE_A -ne 0 -o $RE_B -ne 0 ]
  
then
  
      echo "one of you input is not int"
  
      exit 1
  
fi
  

  
if [ $a -eq $b ];
  
      then
  
      echo "$a = $b"
  
elif [ $a -gt $b ]
  
      then
  
      echo "$a > $b"
  
else
  
      echo "$a < $b"
  
fi
  
# sh test2
  
test20.shtest21.shtest2.sh
  
# sh test21.sh
  
1-10...   zhengshu
  
panduan daxiao:e e
  
one of you input is not int
  
# sh test21.sh
  
1-10...   zhengshu
  
panduan daxiao:2 34
  
2 < 34
  
# sh test21.sh
  
1-10...   zhengshu
  
panduan daxiao:3 3
  
3 = 3
  
#


页: [1]
查看完整版本: Linux-shell之判断大小