【使用例紹介】四則演算、余り:expr【シェルスクリプト】
備忘録になります。
$ cat wrk.sh
COUNT_A=10
COUNT_B=20
echo "足し算"
expr $COUNT_A + $COUNT_B
echo "引き算"
expr $COUNT_A - $COUNT_B
echo "掛け算"
expr $COUNT_A \* $COUNT_B
echo "割り算"
expr $COUNT_A / $COUNT_B
echo "余り"
expr $COUNT_A % $COUNT_B
$ ./wrk.sh
足し算
30
引き算
-10
掛け算
200
割り算
0
余り
10
関連リンク