文件判断参数


  • -e,文件是否存在
  • -f,文件存在且为普通文件
  • -d,文件存在且为文件夹
 #!/bin/bash

 [ -e test.sh ] && echo "test.sh exits"
[ -f test.sh ] && echo "test.sh exits and it's a regular file"
[ -d test.sh ] && echo "test.sh is a directory"
  • 注意做判断语句的中括号需要空格。

最新文章

  1. NSwagStudio for Swagger Api
  2. 解决webkit浏览器中js方法中使用window.event提示未定义的问题
  3. WPF程序在Windows 7下应用Windows 8主题
  4. Laravel教程 一:安装及环境配置
  5. JBOSS的安全配置 .
  6. ADB调试桥安装(方式二)
  7. 在Linux平台上用ASP.NET 5 连接Redis服务器
  8. Android 开机自启动
  9. Oracle_基本函数查询综合
  10. 计算机网络之动态主机配置协议DHCP
  11. github及git使用
  12. Mysql表中唯一编号的分配机制
  13. Linux 压缩归档
  14. Py中pyplot之subplot例子【转载】
  15. C#ref和out的区别-ref是有进有出,out是只出不进
  16. 数学图形(1.40)T_parameter
  17. PHP下使用Redis消息队列发布微博(复制)
  18. Keras中间层输出的两种方式,即特征图可视化
  19. [Luogu1979][NOIP2013]华容道(BFS+SPFA)
  20. bzoj 2118: 墨墨的等式 spfa

热门文章

  1. 一篇看懂Socket开发
  2. C#LeetCode刷题-回溯算法
  3. C#LeetCode刷题之#326-3的幂(Power of Three)
  4. C#LeetCode刷题之#594-最长和谐子序列​​​​​​​​​​​​​​(Longest Harmonious Subsequence)
  5. 简单认识Adam优化器
  6. CPF 入门教程(一)
  7. HTML5+css3 的开心网游戏页面
  8. HotSpot的垃圾回收算法
  9. 开发APP遇到的问题
  10. Python方法oslo_service.loopingcall.LoopingCallDone代码示例