码迷,mamicode.com
首页 > 其他好文 > 详细

bash arithmatic

时间:2014-07-11 22:33:14      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:blog   http   div   re   ar   c   

Arithmetic in bash is done with $ and double parentheses:

echo "$(($num1+$num2))"
Or $ and square brackets:

echo "$[$num1+$num2]"
You can assign from that (sans echo). There is also expr:

echo `expr "$num1" + "$num2"`

  http://unix.stackexchange.com/a/93030

bash arithmatic,布布扣,bubuko.com

bash arithmatic

标签:blog   http   div   re   ar   c   

原文地址:http://www.cnblogs.com/long123king/p/3833046.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!