请你向我解释一下这个shell命令到底是做什么的?很难检索这个-ex选项的描述。
sh #!/bin/bash -ex
提前感谢
发布于 2022-02-08 09:39:33
这意味着您正在使用-e和-x shell选项调用新的bash
请参见此处的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
因为-x类似于-v:
-v verbose Print each command to stdout before executing it
所以它实际上是下降到下一层的外壳:
$ echo $SHLVL
1
$ sh #!/bin/bash -ex
$ echo $SHLVL
2在这个级别2的shell中,选项-e和-x被激活。
https://stackoverflow.com/questions/71031262
复制相似问题