第四章shell及shell编程pps.pptVIP

  • 2
  • 0
  • 约8.68千字
  • 约 52页
  • 2017-09-07 发布于天津
  • 举报
第四章shell及shell编程pps

1)用于对文件的测试 test -[dfrmxs] file 其中:-d file 判文件存在且为目录文件 -f file 判文件存在且为普通文件 -r file 判文件存在且为可读文件 -w file 判文件存在且为可写文件 -x file 判文件存在且为可执行文件 -s file 判文件存在且长度为非零 例:test -d /home/usera echo “目录 usera 存在” test -d /home/usera || echo “ 目录usera不存在或无此目录” 2)对字符串S的测试 test s 字符串S为非空串时返回真值 test -zs 字符串为空时返回真值 test s1=s2 字符串s1与 s2相同时为真值 3)对整数n 进行测试 test n1-eq n2 整数n1和n2相等时为真值 test n1-ne n2 整数n1和n2不相等时为真值 test n1 -lt n2 整数n1小于n2时为真值 test n1 -le n2 整数n1小于等于n2时为真值 test n1 -gt n2 整数n1大于n2时为真值 test n1 -ge n2 整数n1大于等于n2时为真值 测试整数n时注意问题: x1=“005”

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档