Linux学习3之shell的if大小比对使用
2016-03-15 10:20
302 查看
if的大小比对:
if的使用:
需要注意then
具体使用:
参考:
【1】 http://c.biancheng.net/cpp/view/7005.html
#!/bin/sh a=10 b=20 if [ $a == $b ] then echo "a is equal to b" elif [ $a -gt $b ] then echo "a is greater than b" elif [ $a -lt $b ] then echo "a is less than b" else echo "None of the condition met" fi
a is less than b
if的使用:
if ... fi 语句; if ... else ... fi 语句; if ... elif ... else ... fi 语句。
需要注意then
具体使用:
if [ $(echo $endTime | cut -d '.' -f 2) -gt $(echo $startTime | cut -d '.' -f 2) ]; then ... fi
参考:
【1】 http://c.biancheng.net/cpp/view/7005.html
相关文章推荐
- android wifi 无线调试
- 运维入门
- 动态清空 nohup 输出文件
- install scrapy with pip and easy_install
- Linux Shell常用技巧
- Shell 脚本编程陷阱
- oracle sql日期比较
- Flex字符串比较 还有Flex字符串操作
- shell字符串操作详解
- cmd if条件 条件判断
- 详解Lua中的if语句的使用方法
- Shell中删除某些文件外所有文件的3个方法
- perl 控制结构 条件控制 if while
- Ruby中执行Linux shell命令的六种方法详解
- 编程界主流脚本编程语言的比较和选择
- VB使用shell函数打开外部exe程序的实现方法
- Shell编程的一些知识集合
- Shell中的for和while循环详细总结
- 什么是Shell?Shell脚本基础知识详细介绍
- Shell脚本中引用、调用另一个脚本文件的2种方法