shell命令-test
2016-03-12 13:19
253 查看
用途
对表达式进行判断比较
语法
test[expression]或者[ [expression] ]
描述
-b file
file是块设备文件
-e file file存在
-r file file是可读的
-c file
file是字符设备文件
-f file file为一般文件
-w file file是可写的
-d file file是目录
-L file file是符号连接
-x file file是可执行的
-z string 假如 string长度为零,则为真 [ -z "$myvar" ]
-n string 假如 string长度非零,则为真 [ -n "$myvar" ]
举例
对表达式进行判断比较
语法
test[expression]或者[ [expression] ]
描述
-b file
file是块设备文件
-e file file存在
-r file file是可读的
-c file
file是字符设备文件
-f file file为一般文件
-w file file是可写的
-d file file是目录
-L file file是符号连接
-x file file是可执行的
-z string 假如 string长度为零,则为真 [ -z "$myvar" ]
-n string 假如 string长度非零,则为真 [ -n "$myvar" ]
举例
相关文章推荐
- shell特殊符号及变量
- shell简介
- shell学习(照着抄)-日期天数计算
- Linux基础:shell中正则表达式grep,egrep的基础用法
- Shell基础(五):条件判断与流程控制
- Bash脚本编程总结
- 关于shell局部变量和全局变量
- shell订时检测sshd的端口
- linux下shell编程梳理
- 查找两个文件包含的字符串或不包含的字符串shell脚本
- 在 Visual Studio Code 中使用 PoweShell - CodeShell
- 系统加固shell脚本
- shell中正则的用法(grep sed awk)
- shell数组用法
- adb shell commands
- shellinabox安装
- shell 逻辑表达式汇总(if,大小比较)
- shell 脚本
- Unix-Shell
- shell 自动重启nginx php shell脚本