标签:
[root@bogon ~]# cat a.sh #!/bin/bash a=6 b=2 echo "a-b =$(( $a - $b ))" echo "a+b =$(( $a + $b ))" echo "a*b =$(( $a * $b ))" echo "a/b =$(( $a / $b ))" echo "a**b =$(( $a ** $b ))" echo "a%b =$(( $a % $b ))"
结果: [root@bogon ~]# sh a.sh a-b =4 a+b =8 a*b =12 a/b =3 a**b =36 a%b =0 [root@bogon ~]#
[root@bogon ~]# cat a.sh #!/bin/bash echo $(($1$2$3)) [root@bogon ~]# sh a.sh 1+1 2 [root@bogon ~]# sh a.sh 1**1 1 [root@bogon ~]# sh a.sh 1/1 1 [root@bogon ~]#
标签:
原文地址:http://www.cnblogs.com/tangshengwei/p/5391216.html