为什么 shell case 语句中的第一个模式不能是多重模式?
案例
的标准描述声明说:
The format for the case construct is as follows:
case word in
[(]pattern1) compound-list;;
[[(]pattern[ | pattern] ... ) compound-list;;] ...
[[(]pattern[ | pattern] ... ) compound-list]
esac
The ";;" is optional for the last compound-list.
为什么 pattern1
不能也是多重模式?这看起来相当随意,尽管我很确定它一定不是这样。
谢谢!
The standard description of the case
statement says:
The format for the case construct is as follows:
case word in
[(]pattern1) compound-list;;
[[(]pattern[ | pattern] ... ) compound-list;;] ...
[[(]pattern[ | pattern] ... ) compound-list]
esac
The ";;" is optional for the last compound-list.
Why can't be pattern1
be a multiple pattern as well? It seems rather arbitrary, though I'm pretty sure it must not be.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你误解了他们的意思。您链接到的页面上的语法没有显示这样的区别:
I think you're misinterpreting what they're saying. The grammar on the page you link to does not show such a distinction: