What does '#!/bin/sh -xe' mean?
在Tribler的Github上的存储库中,我看到一个带有解释器的文件:
在Mac和Linux上,
在本手册文件中,在以下章节中:
OPTIONS
没有提到期权
口译员
我发现这一点:
1 2 3 4 5 6 7 8 9 10 11 | -x xtrace Write each command to standard error (preceded by a ‘+ ’) before it is executed. Useful for debug‐ ging. -e errexit If not interactive, exit immediately if any untested command fails. The exit status of a com‐ mand is considered to be explicitly tested if the command is used to control an if, elif, while, or until; or if the command is the left hand operand of an"&&" or"||" operator. |
似乎这些只是错误控制选项,可以确保在命令失败时不会发生更糟的情况。
每页:阅读更多
The -a, -b, -C, -e, -f, -m, -n, -o option, -u, -v, and -x options are described as part of the set utility in Special Built-In Utilities. The option letters derived from the set special built-in shall also be accepted with a leading plus sign ( '+' ) instead of a leading hyphen (meaning the reverse case of the option as described in this volume of IEEE Std 1003.1-2001).
当你阅读
-x The shell shall write to standard error a trace for each command after it expands the command and before it executes it. It is unspecified whether the command that turns tracing off is traced.
和
-e When this option is on, if a simple command fails for any of the reasons listed in Consequences of Shell Errors or returns an exit status value >0, and is not part of the compound list following a while, until, or if keyword, and is not a part of an AND or OR list, and is not a pipeline preceded by the ! reserved word, then the shell shall immediately exit.