请参考博客园: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]#

 

相关文章:

  • 2021-07-25
  • 2021-07-19
  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2021-06-17
猜你喜欢
  • 2022-12-23
  • 2021-11-24
  • 2022-01-02
  • 2022-02-10
  • 2021-11-09
相关资源
相似解决方案