I am using Ubuntu 14.04 and i tried this :
$ x=20
$ y=5
$ expr x / y
But i got this error:
expr: non-integer argument
您必须展开变量以获取其值: $x
和$y
:
expr $x / $y
Using modern Bash arithmetics:
echo $((x / y))
To assign the result to a variable z
:
((z = x / y))
To verify the value of z
:
echo $z
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.