如何消除"set -e"的影响?如果有任何命令失败,这会使bash立即退出? [英] How to undo the effect of "set -e" which makes bash exit immediately if any command fails?

查看:338
本文介绍了如何消除"set -e"的影响?如果有任何命令失败,这会使bash立即退出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在交互式bash shell中输入set -e后,如果有任何非零的命令退出,bash将立即退出.我该如何消除这种影响?

After entering set -e in an interactive bash shell, bash will exit immediately if any command exits with non-zero. How can I undo this effect?

推荐答案

使用set +e.是的,使用set -启用 外壳选项并使用set +禁用 都是很落后的.历史葡萄干,唐尚.

With set +e. Yeah, it's backward that you enable shell options with set - and disable them with set +. Historical raisins, donchanow.

这篇关于如何消除"set -e"的影响?如果有任何命令失败,这会使bash立即退出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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