Bash编程基础
来源:互联网 发布:淘宝如何修改最低折扣 编辑:程序博客网 时间:2024/06/09 20:41
先上一段简单代码:
#!/bin/shline="23"line=`expr $line + 1`if [[ $line -gt "30" ]]then echo "Greater than."elif [[ $line -ne "0" ]]then echo "Not equals 0"else echo "Less than."fiecho $line
if ... then ... elif ... then ... else ... fi
then需要另起一行。需要和if在一行时, ]]后加;
比较
-gt: greater than
-lt: less than
-eq: equals
-ne: not equals
-ge: greater or equals
-le: less or equals
这些用于数字比较。字符串比较用>, <, ==等。
if [[ "85%" > "80%" ]]; then echo "85% >= 80%"fi
-n 非空字符串
-z 空字符串
用于做四则运算
expr 1 + 1这里 + 前后必须有空格
0 0
- Bash脚本编程基础
- bash基础编程总结
- Bash编程基础
- Linux Bash 编程基础
- BASH使用基础及SHELL编程基础
- The fundamentals of Bash Scripting(Bash脚本编程基础)|nettusplus
- bash编程读书笔记(基础篇I)
- bash编程读书笔记(基础篇II)
- 《学习bash》笔记--基础shell编程
- Bash Shell脚本编程-基础特性知识
- 【bash】编程基础之常用变量,符号
- bash 基础
- Bash 基础
- Bash基础
- Bash基础
- bash基础
- bash 基础
- Bash基础
- Android中将View的内容保存为图像的方法
- File && FileDescriptor
- Ubuntu编译VLC
- 判定质数
- 使用ViewPager进行页面滑动切换
- Bash编程基础
- uboot详解
- Android——build.prop 解析
- 设计模式12--代理模式(Proxy)
- cocos2d-x绑lua的开发环境
- Button或者ImageButton的背景设为透明或者半透明--透明度
- zebra命令行编写(二)
- DB2的sql
- Ubuntu 12.04 安装mysql及mysql-python