31 lines
343 B
Bash
31 lines
343 B
Bash
#!/usr/bin/env bash
|
|
|
|
a=10
|
|
b=20
|
|
|
|
echo "a=$a, b=$b"
|
|
|
|
val=`expr $a + $b`
|
|
echo "a + b : $val"
|
|
|
|
val=`expr $a - $b`
|
|
echo "a - b : $val"
|
|
|
|
val=`expr $a \* $b`
|
|
echo "a * b : $val"
|
|
|
|
val=`expr $b / $a`
|
|
echo "b / a : $val"
|
|
|
|
val=`expr $b % $a`
|
|
echo "b % a : $val"
|
|
|
|
if [ $a == $b ]
|
|
then
|
|
echo "a 等于 b"
|
|
fi
|
|
if [ $a != $b ]
|
|
then
|
|
echo "a 不等于 b"
|
|
fi
|