num1 = 20
num2 = 20
echo $(( num1 + num2 ))
echo $(( num1 - num2 ))
echo $(( num1 * num2 ))
echo $(( num1 / num2 ))
echo $(( num1 % num2 ))
错误 :
./practice.sh: line 53: num1: command not found
./practice.sh: line 54: num2: command not found
0
0
0
./practice.sh: line 59: num1 / num2 : division by 0 (error token is "num2 ")
./practice.sh: line 60: num1 % num2 : division by 0 (error token is "num2 ")
我缺少什么?当我尝试一些数字而不是num1
内部num2
回声时。我注意到它打印正确......但是,这里发生了什么......?
答案1
num1=20
num2=20
当我尝试从 num1 和 num2 中删除空格时。我注意到它正在工作