在 bash 脚本/shell 中,是否有一种编程方式来确定是否set -e标志处于活动状态吗?
set -e
我只需要一个布尔值让我知道它是否打开/关闭。
From help test:
help test
-o OPTION True if the shell option OPTION is enabled.
Thus:
[ -o errexit ]