bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Vladimir Marek
Subject: Re: [IDEA] more granular shell options to fix errexit
Date: Thu, 3 Jan 2019 17:46:31 +0100
User-agent: Mutt/1.5.22.1-rc1 (2013-10-16)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]