Linux Shell : Test命令参数解析
2015-05-04 10:21
561 查看
转自http://blog.chinaunix.net/uid-21961753-id-1810588.html
格式: test conditions
test -n string : string 不为空
test -z string : string 为空
test int1 -eq int2 : int1 == int 2
test int1 -ne int2 : int1 != int2
test int1 -gt int2 : int1 > int2
test int1 -ge int2 : int1 >= int2
test int1 -lt int2 : int1 < int2
test int1 -le int2 : int1 <= int2
test -r filename : 用户对文件filename有读权限
test -w filename : 用户对文件filename有写权限
test -x filename : 用户对文件filename有可执行权限
test -f filename : 文件filename为普通文件
test -d filename : 文件filename为目录
test -c filename : 文件filename为字符设备文件
test -b filename :文件filename为块设备文件
test -s filename : 文件filename大小不为零
test -t fnumb : 与文件描述符fnumb(默认值为1)相关的设备是一个终端设备
test ! -s empty : empty 为空
test -a : And
test -o : Or
注意test命令和[ ]中括号作用是一样的。。
格式: test conditions
test -n string : string 不为空
test -z string : string 为空
test int1 -eq int2 : int1 == int 2
test int1 -ne int2 : int1 != int2
test int1 -gt int2 : int1 > int2
test int1 -ge int2 : int1 >= int2
test int1 -lt int2 : int1 < int2
test int1 -le int2 : int1 <= int2
test -r filename : 用户对文件filename有读权限
test -w filename : 用户对文件filename有写权限
test -x filename : 用户对文件filename有可执行权限
test -f filename : 文件filename为普通文件
test -d filename : 文件filename为目录
test -c filename : 文件filename为字符设备文件
test -b filename :文件filename为块设备文件
test -s filename : 文件filename大小不为零
test -t fnumb : 与文件描述符fnumb(默认值为1)相关的设备是一个终端设备
test ! -s empty : empty 为空
test -a : And
test -o : Or
注意test命令和[ ]中括号作用是一样的。。
相关文章推荐
- Linux Shell : Test命令参数解析
- Linux Shell : Test命令参数解析
- Linux Shell : Test命令参数解析
- Linux Shell : Test命令参数解析
- Linux Shell : Test命令参数解析
- linux Shell : Test命令参数解析
- Shell Test命令参数解析
- Shell Test命令参数解析
- Shell Test命令参数解析
- 自学Linux Shell12.2-test命令
- 解析ANDROID ps命令执行后各项参数的含义
- test命令常用检查参数
- mysql中explain命令出现的参数的解析
- asterisk dial 命令参数解析
- 传递带空格的参数给linux shell中的java命令
- asterisk dial 命令参数解析
- Linux shell 的 test 命令用法详解
- Linux SHELL if 命令参数说明
- linux shell中的命令自动补全(compgen complete)与 命令行参数解析
- Linux SHELL if 命令参数说明