#!/bin/sh
if [ $num -eq 9 -o $num -eq 75 -o $num -eq 200 ]; then
echo "do this"
elif [ $num -eq 40 -o $num -eq 53 -o $num -eq 63]; then
echo "do something for this"
else
echo "for other do this"
fi
お問い合わせの表現を絞り込む他の方法はありますかif
?たぶん良い
[ $num -eq (9,75,200) ]
しかし、このOSにはGNUユーティリティはありません。
ベストアンサー1
時々、他の構造がより読みやすくなることがあります。
case $num in
9|75|200) echo "do this" ;;
40|53|63) echo "do something for this" ;;
*) echo "for other do this" ;;
esac