Bash Case语句的终结符
source link: https://www.lujun9972.win/blog/2019/07/01/bash-case%E8%AF%AD%E5%8F%A5%E7%9A%84%E7%BB%88%E7%BB%93%E7%AC%A6/index.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Bash Case语句的终结符
Case分支语句的一般常用格式是这样的:
case $变量名 in 模式1) 命令序列1 ;; 模式2) 命令序列2 ;; *) 默认执行的命令序列 ;; esac
但是今天偶尔看到 bash manual 中关于 case 语句的说明中有这么一段:
If the ;; operator is used, no subsequent matches are attempted after the first pattern match. Using ;& in place of ;; causes execution to continue with the list associated with the next set of patterns. Using ;;& in place of ;; causes the shell to test the next pattern list in the statement, if any, and execute any associated list on a successful match.
也就是说,case语句的分句终止符不仅仅可以时 ;;
还可以 ;&
和 ;;&
, 他们的作用分别为:
;;不再进行后续的匹配,直接跳出case语句 ;&不再进行后续的匹配,继续执行后面的case分句 ;;&继续对后面的case分句进行匹配,若能找到匹配项则执行该分句。
Recommend
-
41
德国 “德国例外论”的终结 拉赫曼:德国新选择党表现强劲,说明德国失去了对民粹主义的免疫力,看起来更像一个“普通”的西方国家了。
-
104
405 很抱歉,由于您访问的URL有可能对网站造成安全威胁,您的访问被阻断。 您的请求ID是: 2760823b16523919490412528e80d8 ...
-
104
柯洁终结41连胜围棋AI:称其实力远超初代AlphaGo 2017年11月18日 12:21 16798 次阅读 稿源:
-
89
为什么作者说云时代的终结即将来临?如果是这样,那么需要用什么来替代云?请听作者的分析。
-
69
终结手机碎屏!现在,只需用手按住断面,屏幕就能自愈陈大志·2017-12-20 05:41意外发现的美丽。手机碎屏这种事情,不管你有...
-
53
互联网巨头的终结
-
79
这套方法论,彻底终结MySQL同步延迟问题!
-
75
作为一名DBA,在工作中会经常遇到一些MySQL主从同步延迟的问题,这些同步慢的问题,其实原因非常多,可能是因为主从的网络问题导致,可能是因为网络带宽问题导致,可能是因为大事务导致,也可能是因为单线程复制导致的延迟。最近遇到一个很典型的同步延迟问题,将...
-
45
来源:界面新闻作者:李媚玲“旧的亚洲奇迹将被AI所终结。” 对于AI人工智能的发展是否会大规模取代发展中国家制造业的工作岗位这个问题,微软创始人比尔·盖茨如是说。美国东部时间2月13日下午,比尔·盖茨及其妻子梅琳达·盖茨在纽约城市
-
3
Bash中的TryCatch语句 Bash 中是没有原生的Try Catch 语句的,但是今天从 https://www.xmodulo.com/catch-handle-errors-bash.html 上我看到了一种模拟 Try Catch 的方法。
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK