|
发表于 2003-9-19 00:17:05
|
显示全部楼层
用(())可以:
[/home/javalee/myshell]a=134
[/home/javalee/myshell]b=33
[/home/javalee/myshell]c=$((a*b))
[/home/javalee/myshell]echo $c
4422
[/home/javalee/myshell]d=$((a/b))
[/home/javalee/myshell]echo $d
4
[/home/javalee/myshell]e=$((a%b))
[/home/javalee/myshell]echo $e
2
[/home/javalee/myshell]
用bc,也可以:
[/home/javalee/myshell]echo "$a*$b"|bc
4422
[/home/javalee/myshell]echo "$a/$b"|bc
4
[/home/javalee/myshell]echo "$a%$b"|bc
2
当然,用expr也可以(略) |
|