DEMO:
[xiluhua@vm-xiluhua][~]$ num1=5 [xiluhua@vm-xiluhua][~]$ num2=10 [xiluhua@vm-xiluhua][~]$ num3=$(($num1+$num2)) #嵌套变量加法运算并赋值 [xiluhua@vm-xiluhua][~]$ echo $num315 [xiluhua@vm-xiluhua][~]$ num4=$(($num2%3)) #嵌套变量取余运算并赋值 [xiluhua@vm-xiluhua][~]$ echo $num41 [xiluhua@vm-xiluhua][~]$ echo $(( 5 > 10 )) #比较运算,假返回00 [xiluhua@vm-xiluhua][~]$ echo $(( $num2 > $num1 )) #比较运算,真返回11 [xiluhua@vm-xiluhua][~]$ num5=$(( $(($num1>$num2))?$num1:$num2 )) #三目运算符举例[xiluhua@vm-xiluhua][~]$ echo $num510