的选择使用提供了语法错误 [英] Use of select gives syntax error

查看:142
本文介绍了的选择使用提供了语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图得到这个工作:

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

我不断收到此错误:

I keep getting this error:

menu.sh:2:选择:未找到结果
  menu.sh:7:语法错误:完成意外

menu.sh: 2: select: not found
menu.sh: 7: Syntax error: "done" unexpected

在此先感谢,

Thanks in Advance, joe

推荐答案

请确保您正在运行它在庆典选择庆典,而不是由一些炮弹像 SH

Make sure you are running it in bash as select is understood by bash and not by some shells like sh.

这篇关于的选择使用提供了语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆