shell变量的使用

1、两个数相加

    变量1=`expr $变量2 + $变量3`

    变量1=`expr $变量2 + 常数`

2、两个数相减

    变量1=`expr $变量2 - $变量3`
    变量1=`expr $变量2 - 常数

3、两个数相乘

    变量1=`expr $变量2 \* $变量3`
    变量1=`expr $变量2 \* 常数`

4、两个数相除

    变量1=`expr $变量2 / $变量3`
    变量1=`expr $变量2 / 常数`

你可能感兴趣的:(shell变量的使用)