请参考博客园:https://www.cnblogs.com/guanyf/p/7553940.html
test –e File 文件存在
test –r File 文件存在并且可读
事例如下
test -e /usr/local/software/ && echo "Have software folder" test -f ~/1234abc.txt || echo "Don't have 1234abc.txt" [root@localhost klaus]# if test -z "$?";then ;echo OK;fi bash: syntax error near unexpected token `;' [root@localhost klaus]# if test ! -n "$?";then echo OK;fi [root@localhost klaus]#