[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Looking for something like "errexit" for interactive ses
From: |
Eduardo Bustamante |
Subject: |
Re: [Help-bash] Looking for something like "errexit" for interactive sessions |
Date: |
Tue, 27 Aug 2019 18:37:28 -0700 |
On Tue, Aug 27, 2019 at 4:00 PM Eric Pruitt <address@hidden> wrote:
>
> Is there a feature akin to errexit that's interactive session friendly
> i.e. instead of causing the session to exit, it'd drop the user back to
> a prompt if a command finished with a non-zero status?
I believe you might be able to use:
- The "ERR" trap - I'm not sure how to make it return control to the
parent shell though.
- the "DEBUG" trap + extdebug - See the "extdebug" entry under the
description of the "shopt" builtin of the Bash manual. You can use the
exit status of the trap to decide whether a command runs or not.
You might also have to use 'set -T' (functrace) with the above.
Sorry, it's been a long time since I've used these so maybe it works,
maybe it doesn't.