我当前的脚本是这样的,但只有一个答案。
A1="hp"
echo
echo 1.What os uses swinstall for software installs?
read answer
if [ "$answer == "$A1" ]; then
echo "correct"
else
echo "incorrect"
fi
(对于有两个答案的问题)我想代替这个看到下面我希望他们能够选择回答顶部虽然。 回答答案可能是hp或ux
答案 0 :(得分:0)
使用案例陈述怎么样?这允许一点灵活性:
A1="hp"
A2="ux"
echo
echo 1. What OS uses swinstall for software installs?
read answer
case $answer in
($A1) echo "correct"
;;
($A2) echo "correct"
;;
(*) echo "incorrect"
;;
esac