[英]Bash command option clarification bash -ex
could you please explain to me what exactly this shell command do?你能向我解释一下这个 shell 命令到底是做什么的吗? It is quite difficoult to retrive the description of this -ex option.
要检索这个 -ex 选项的描述是相当困难的。
sh #!/bin/bash -ex sh #!/bin/bash -ex
Thanks in advance提前致谢
It means you're invoking new bash shell with -e and -x shell options这意味着您正在使用 -e 和 -x shell 选项调用新的 bash shell
See shell options here: https://tldp.org/LDP/abs/html/options.html请在此处查看 shell 选项: https://tldp.org/LDP/abs/html/options.html
-e errexit Abort script at first error, when a command exits with non-zero status (except in until or while loops, if-tests, list constructs)
-x xtrace Similar to -v, but expands commands
since -x is similar to -v:因为 -x 类似于 -v:
-v verbose Print each command to stdout before executing it
So it's actually dropping to next level shell:所以它实际上下降到下一级 shell:
$ echo $SHLVL
1
$ sh #!/bin/bash -ex
$ echo $SHLVL
2
in which in this level 2 shell, option -e and -x is activated其中在这个级别 2 shell 中,选项 -e 和 -x 被激活
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.