#! /bin/sh # 加減乘除的小腳本,主要練習case語句 case $2 in +) echo "$1 + $3 = `expr $1 + $3` " ;; -) echo "$1 - $3 = `expr $1 - $3`" ;; \*) echo "$1 * $3 = `expr $1 \* $3`" ;; /) if [ $3 = 0 ] then echo "除數不能爲0" else echo "$1 / $3 = `expr $1 / $3`" fi ;; *) echo "您的輸入不符合規範,請從新輸入" esac