当前位置: 技术问答>linux和unix
困惑,select语句的问题
来源: 互联网 发布时间:2016-10-28
本文导语: #!/bin/sh echo "What is your favourite OS?" select var in "Linux" "Gnu Hurd" "Free BSD" "Other"; do break done echo "You have selected $var" 以上的语句有错吗?为什么总是报错?如下: what is your favourite OS ./sh05.sh: 4: select:...
#!/bin/sh
echo "What is your favourite OS?"
select var in "Linux" "Gnu Hurd" "Free BSD" "Other"; do
break
done
echo "You have selected $var"
以上的语句有错吗?为什么总是报错?如下:
what is your favourite OS
./sh05.sh: 4: select: not found
./sh05.sh: 6: Syntax error: "done" unexpected
如果把#!/bin/bash就不报错了。这是为什么啊?
#!/bin/bash
echo "What is your favourite OS?"
select var in "Linux" "Gnu Hurd" "Free BSD" "Other"; do
break
done
echo "You have selected $var"
|
一般bash即可
大部分linux发行版下,sh是bash的一个软链接
大部分linux发行版下,sh是bash的一个软链接