linux shell 数值比较错误
来源:互联网 发布:mac不能播放视频 编辑:程序博客网 时间:2024/06/06 03:16
这几天在写shell脚本,其中一个就是比较数值,测试的那几次都是正确的,但到了线上就出错了。脚本是这样的
if [[ $fileCount > 20 ]]then echo "too much files, waiting for uploading."else echo "ok."fi
修改方法也很简单,将比较符换成“-gt”就可以了:
if [[ $fileCount -gt 20 ]]then echo "too much files, waiting for uploading."else echo "ok."fi
其他的比较符:
-eq 等于,如:if [ "$a" -eq "$b" ]
-ne 不等于,如:if [ "$a" -ne "$b" ]
-gt 大于,如:if [ "$a" -gt "$b" ]
-ge 大于等于,如:if [ "$a" -ge "$b" ]
-lt 小于,如:if [ "$a" -lt "$b" ]
-le 小于等于,如:if [ "$a" -le "$b" ]
这个的原因,还不知道...
0 0
- linux shell 数值比较错误
- linux shell 字符比较与数值比较,bash的调试
- linux shell 字符比较与数值比较,bash的调试
- linux shell 字符比较与数值比较,bash的调试
- Shell数值、字符串比较
- bash shell 数值比较
- Shell数值、字符串比较
- shell 数值 字符串比较
- Shell数值、字符串比较
- Shell数值、字符串比较
- Shell数值、字符串比较
- shell编程-数值比较
- Shell数值及字符串比较
- shell数值和字符比较
- shell比较大小数值字符串
- shell 下数值、字符串比较
- Shell编写比较数值大小
- linux shell 数值运算
- 性能优化六之Lint工具使用
- 【好久没有更新了】关于接下来的博客更新,和最近的情况
- BZOJ1070 修车(zkw费用流 or spfa费用流)
- 1120. Friend Numbers (20)
- Android DataBinding的基本用法
- linux shell 数值比较错误
- STL容器解析之List
- 1121. Damn Single (25)
- 范围确认和范围控制
- HTML的基础知识(1)
- [洛谷P3395]路障题解
- java中的异常类体系
- ORA-16019: cannot use LOG_ARCHIVE_DEST_1 with..
- equals Hashtable 和 ==