更多Bash选择菜单选项

jmi*_*zas 0 bash

我怎样才能有更多选择来回答这个问题?

while [ "$yn" != "Yes" ]; do
 echo "Please enter your Host Name"
 read hname
 echo "You have entered $hname, is this correct? (Yes or No)"
  read yn
done
sh runscript.sh
Run Code Online (Sandbox Code Playgroud)

想回答"是""是""Y"或"y",怎么办呢?乔,先谢谢你

Pau*_*ce. 6

while [ -z "$yn" ]
do
    read -p "Please enter your Host Name" hname
    read -p "You have entered $hname, is this correct? (Yes or No)" yn
    case $yn in
        Y|y|Yes|yes);;    # this is a no-op
        *) unset yn;;
    esac
done
Run Code Online (Sandbox Code Playgroud)