'#!/bin/sh -xe' 是什么意思?

azb*_*zbc 5 bash sh

Tribler 的GitHub 上的存储库中,我看到一个带有解释器的文件#!/bin/sh -xe.

在 Mac 和 Linux 上man sh重定向到BASH(1)(与 相同man bash)。

在这个 man 文件中,在以下部分:

选项

,没有提到选项-x,也没有选项-e

口译员的意思是#!/bin/sh -xe什么?

Cal*_* H. 9

我找到了这个:

man sh

-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.
Run Code Online (Sandbox Code Playgroud)

似乎这些只是错误控制选项,可确保在命令失败时不会发生更糟糕的事情。