Shell script 中 if 语句的条件判断字符的含义
2011-06-29 22:02
399 查看
为了捣鼓 FreeNAS 开始看一些系统自带的 shell script,但是老本都亏空了,只能大概看懂,基本的 if 语句中判断字符都忘记了。搜了一下,记录在这里,方便以后查询。
短小精悍的在这里 http://lowfatlinux.com/linux-script-logic.html 最全面的在这里http://www.freeos.com/guides/lsst/
Comparisons:
File Operations:
-n 变量是否有值
-z 变量是否为空
两个条件的联合判断
-a and
-o or
! not
短小精悍的在这里 http://lowfatlinux.com/linux-script-logic.html 最全面的在这里http://www.freeos.com/guides/lsst/
Comparisons:
-eq | equal to |
-ne | not equal to |
-lt | less than |
-le | less than or equal to |
-gt | greater than |
-ge | greater than or equal to |
-s | file exists and is not empty |
-f | file exists and is not a directory |
-d | directory exists |
-x | file is executable |
-w | file is writable |
-r | file is readable |
-z 变量是否为空
两个条件的联合判断
-a and
-o or
! not
相关文章推荐
- c语言:不用if,else语句,也不用循环条件等,输入一个字符,判断是否为大写字母
- c语言:不用if,else语句,也不用循环条件等,输入一个字符,判断是否为大写字母
- 求1+2+…+n 要求不能使用 乘 除 法、for、while、if、else、switch、case等关键字以及条件判断语句
- 语法分析——在之前基础上增加定义语句打印,定义语句判断,增加对if-else-then的条件语句的判断
- 求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。
- bash编程之条件判断,if语句!
- java的if else if语句的判断条件不能相同
- 【九度1506】求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。
- ORALCE的几种IF条件判断语句
- C#条件判断-if语句简单结构
- if语句条件判断
- 1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)
- 求1+2+。。。+n,不用乘除,for、while、if、else、switch、case等关键字及条件判断语句
- 【练习】题目:求1+2+…+n,要求不能使用乘除法、for、while、if、else、switch、case 等关键字以及条件判断语句
- 求1+2+3+...+n,要求不能使用乘除法,for,while,if,else,switch,case等关键字以及条件判断语句
- 【PHP之If…Else 条件判断语句】
- 求1+2+3+...+n,要求不能使用乘除法,for,while,if,else,switch,case等关键字以及条件判断语句
- java题目:求 1+2+...+n,要求不能用除法、 for、 while、 if、 else、 switch、 case 等关键字及条件判断语句( A?B:C)。
- Linux shell脚本编程if语句的使用方法(条件判断)
- shell脚本编程:条件判断if语句使用小结