Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15038

Re: [IDEA] more granular shell options to fix errexit

From Vladimir Marek <Vladimir.Marek@oracle.com>
Newsgroups gnu.bash.bug
Subject Re: [IDEA] more granular shell options to fix errexit
Date 2019-01-03 17:46 +0100
Message-ID <mailman.6729.1546534006.1284.bug-bash@gnu.org> (permalink)
References <00c8e3c7-1dd2-1154-da89-a31e1a6fb515@mail.mipt.ru>

Show all headers | View raw


Hi,

[...]

> The following suggested options aim to eliminate all cases that still exist,
> outlined on the above link, where an exit code of a command is
> swallowed/ignored.

[...]

My take on this, purely from user's point of view is to be able to
instruct bash to exit any time any command returns non-zero value unless
the situation is handled in the code. That means inside of

if command;  then ...
or
command || blah

So what you suggested is something I would like to use. If I would to
have command which does not terminate

command || :

If I want to catch the return value

command && RET=$? || RET=$?
OUT=$(command) && RET=$? || RET=$?


Cheers
-- 
	Vlad

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: [IDEA] more granular shell options to fix errexit Vladimir Marek <Vladimir.Marek@oracle.com> - 2019-01-03 17:46 +0100

csiph-web