1、测试1
[root@centos7 test2]# ls
a.txt
[root@centos7 test2]# if [ -e a.txt ]; then echo "exist";else echo "no nxist"; fi
exist
[root@centos7 test2]# if [ -e b.txt ]; then echo "exist";else echo "no nxist"; fi
no nxist
2、测试2
[root@centos7 test2]# seq 3 > a.txt
[root@centos7 test2]# seq 5 > b.txt
[root@centos7 test2]# anum=$(wc -l a.txt|awk ‘{print $1}‘)
[root@centos7 test2]# bnum=$(wc -l b.txt|awk ‘{print $1}‘)
[root@centos7 test2]# if [ $anum -gt $bnum ]; then echo "a > b"; else echo "b > a"; fi
b > a