[英]Difference between ;& and ;; in a bash script
I'm copying a bash script from a Linux box to my Mac laptop and in the process, the script has started complaining about the usage of ;&
. 我正在将一个bash脚本从一个Linux盒子复制到我的Mac笔记本电脑上,在这个过程中,脚本开始抱怨使用
;&
。
With the error: 有错误:
./build.sh: line 122: syntax error near unexpected token `;'
./build.sh:line 122:意外标记附近的语法错误`;'
./build.sh: line 122: ` ;&'./build.sh:line 122:`;&'
There's a few uses in the script, but a short one is: 脚本中有一些用法,但简短的用法是:
case ${OPTION} in
xxx)
export DEVICES=xxx
;;
yyy)
export DEVICES=yyy
;;
*)
echo "${OPTION}: Unknown device type: use xxx|yyy"
exit 1
;&
esac
;;
I've replaced all usages of ;&
with ;;
我已经取代了所有的用法
;&
with ;;
and I think that everything is ok, but I'm still curious what I've done. 而且我认为一切都还可以,但我仍然很好奇我做了什么。 What's the difference between semicolon-ampersand and double semicolon in case statements?
案例陈述中分号符号和双分号之间的区别是什么?
From man bash
: 来自
man bash
:
Using ;& in place of ;;
使用;代替;; causes execution to continue with the list associated with the next set of patterns.
导致执行继续与下一组模式相关联的列表。
Since ;&
occurs on the last pattern in the case
statement, it should make no difference in that script. 因为
;&
发生在case
语句的最后一个模式中,它应该在该脚本中没有区别。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.