shell 文件判断
2024-10-09 14:30:32
文件判断参数
- -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"
- 注意做判断语句的中括号需要空格。
最新文章
- NSwagStudio for Swagger Api
- 解决webkit浏览器中js方法中使用window.event提示未定义的问题
- WPF程序在Windows 7下应用Windows 8主题
- Laravel教程 一:安装及环境配置
- JBOSS的安全配置 .
- ADB调试桥安装(方式二)
- 在Linux平台上用ASP.NET 5 连接Redis服务器
- Android 开机自启动
- Oracle_基本函数查询综合
- 计算机网络之动态主机配置协议DHCP
- github及git使用
- Mysql表中唯一编号的分配机制
- Linux 压缩归档
- Py中pyplot之subplot例子【转载】
- C#ref和out的区别-ref是有进有出,out是只出不进
- 数学图形(1.40)T_parameter
- PHP下使用Redis消息队列发布微博(复制)
- Keras中间层输出的两种方式,即特征图可视化
- [Luogu1979][NOIP2013]华容道(BFS+SPFA)
- bzoj 2118: 墨墨的等式 spfa
热门文章
- 一篇看懂Socket开发
- C#LeetCode刷题-回溯算法
- C#LeetCode刷题之#326-3的幂(Power of Three)
- C#LeetCode刷题之#594-最长和谐子序列​​​​​​​​​​​​​​(Longest Harmonious Subsequence)
- 简单认识Adam优化器
- CPF 入门教程(一)
- HTML5+css3 的开心网游戏页面
- HotSpot的垃圾回收算法
- 开发APP遇到的问题
- Python方法oslo_service.loopingcall.LoopingCallDone代码示例