使用select会出现语法错误

jmi*_*zas 3 syntax bash select syntax-error

我想让这个工作:

echo "Would you like to configure dns?"
select yn in "Yes" "No"; do
    case $yn in
        Yes ) echo "you have selected to configure dns"; break;;
        No ) exit; break;;
    esac
done
Run Code Online (Sandbox Code Playgroud)

我一直收到这个错误:

menu.sh:2:select:not found
menu.sh:7:语法错误:"done"意外

乔,先生,谢谢

cod*_*ict 12

确保你bash按照select理解的方式运行它,bash而不是像某些shell那样sh.