晕,得不了C的值。
发表于 : 2008-08-26 18:48
学习中遇到到个问题:
a=1
b=2
c=$a+$b
declare -i c
echo $c
本来想得到3的,却不料总得到1+2,晕了。。。唉,求正解。
a=1
b=2
c=$a+$b
declare -i c
echo $c
本来想得到3的,却不料总得到1+2,晕了。。。唉,求正解。
代码: 全选
declare
Declare variables and give them attributes.
-i The variable is to be treated as an integer;
arithmetic evaluation is performed when the
variable is assigned a value.