shell脚本中的算术运算
来源:互联网 发布:西安 长沙 知乎 编辑:程序博客网 时间:2024/05/17 22:04
shell脚本只提供整数算术运算(三种方式)—
((表达式))
let "表达式"
value=`expr 表达式右边`
数值运算:
在bash中只提供了整数运算,一般shell通过let和expr这两个指令来实现。
使用格式为: let "x=$x+1" 或者 x=`expr $x+1`
同时,在shell中,也可以通过((表达式))。
使用格式为:((x=$x+1))
在上面的三种方式中,运算符还可以是:
+、-、*、/、% //加、减、乘、除、模
>>、<<、&、^、| //右移、左移、位与、位反、位或
?: //三目运算符,和C语言的一样。
C语言支持的运算符,在Shell的整数运算中,都支持。
原文:http://blog.163.com/xychenbaihu@yeah/blog/static/132229655201131055455754/ 0 0
- shell脚本中的算术运算
- shell脚本中的算术运算
- shell脚本算术运算
- shell 中的算术运算
- shell 中的算术运算
- shell中的算术运算
- shell中的算术运算
- Shell 脚本中的算术运算与常用条件表达式
- shell中的算术运算总结
- Shell中的算术运算(译)
- Shell脚本学习笔记(三)--算术运算
- shell 脚本编程之算术运算符
- Shell脚本中的运算
- Shell脚本学习第五天——算术运算符
- shell脚本中的数值运算
- shell脚本中的数学运算
- shell脚本中的数值运算
- shell算术运算
- sun-java6-jdk:i386 : 依赖: sun-java6-bin:i386
- 7z 解压加密文件
- URAL 1980 Road to Investor 二分+最短路
- ORACLE 普通表转换成分区表(在线重定义)
- ios实现程序切入后台,实现后台任务
- shell脚本中的算术运算
- 云算法调用平台--web 工程调用hadoop集群1.3
- Linux CURL的安装和使用
- sybase分页的实现
- 重新获取验证码的按钮
- 第39级台阶
- [1355] Heaven Needn't Use Money
- linux命令英文全称
- Android 之 dex.jar和dx.jar问题