shell脚本错误总结
2014-01-07 14:08
204 查看
1../jiance.sh: line 34: [: -gt: unary operator expected
原码:if [ $sda1_usage -gt $hd_quota ] || [ $sda2_usage -gt $hd_quota ] || [ $lv01_usage -gt $hd_quota ]; then
究其原因,是因为如果变量$sda1_usage值为空,那么就成了 [ =
$hd_quota ],显然 [ 和 "qps" 不相等并且缺少了 [ 符号,所以报了这样的错误。这样的错误还是很隐蔽的。
1../jiance.sh: line 34: [: -gt: unary operator expected
原码:if [ $sda1_usage -gt $hd_quota ] || [ $sda2_usage -gt $hd_quota ] || [ $lv01_usage -gt $hd_quota ]; then
究其原因,是因为如果变量$sda1_usage值为空,那么就成了 [ =
$hd_quota ],显然 [ 和 "qps" 不相等并且缺少了 [ 符号,所以报了这样的错误。这样的错误还是很隐蔽的。
相关文章推荐
- shell special characters within shell command lines
- linux shell实现URL 编码/解码
- bash小结
- shell脚本汇总
- 随笔-shell发送请求并分析
- 随笔-shell发送请求并分析
- ShellExecute指定IE浏览器打开网页
- error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js
- shell中的进制转换
- impala-shell 命令参考(翻译)
- impala-shell 命令行选项(翻译)
- 使用 Impala Shell(翻译)
- shell中的if用法
- bash shell脚本实用方法
- [shell-基础] 比较与测试
- [shell-基础] 字段分隔符和迭代器
- [shell-基础] 以不回车的方式读取字符“n”
- [shell-基础] 读取命令序列输出
- [shell-基础] 函数和参数
- [shell-基础] 调试脚本