确定`set -e`标志是否在bash中处于活动状态 [英] Determine if `set -e` flag if is active in bash

查看:37
本文介绍了确定`set -e`标志是否在bash中处于活动状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在bash脚本/shell中,是否可以通过编程方式确定 set -e 标志是否处于活动状态?

In a bash script/shell, is there a programmatic way to determine if the set -e flag is active?

我只需要一个布尔值让我知道它是否打开/关闭.

I just need a boolean letting me know if it's on/off.

推荐答案

来自帮助测试:

    -o OPTION      True if the shell option OPTION is enabled.

因此:

[ -o errexit ]

这篇关于确定`set -e`标志是否在bash中处于活动状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆