[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Looking for something like "errexit" for interactive ses
From: |
Eric Pruitt |
Subject: |
Re: [Help-bash] Looking for something like "errexit" for interactive sessions |
Date: |
Wed, 28 Aug 2019 18:29:52 -0700 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Wed, Aug 28, 2019 at 01:53:10PM -0400, Eli Schwartz wrote:
> Now you want to do... what? What is your desired goal if a command fails?
>
> [...]
>
> What is your middle ground that you wish to see?
The middle ground is going to the prompt in situations where the shell
would exit with errexit. If the option existed and was called
"err>prompt<" instead "err>exit<", I'd want it to work like this:
# Normal session
~$ true; echo x; (exit 123); echo y
x
y
# With non-existent option I'm calling errprompt
~$ set -o errprompt
~$ true; echo x; (exit 123); echo y
x
~$ echo $?
127
Essentially it's analogous to errexit but, instead of exiting, it dumps
you back at a prompt as described in my original message:
> 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
With errexit, in an interactive shell, a failing command nukes the whole
session which is not desirable for me. I want the session to keep
running. Clear?
Eric