help-bash
[Top][All Lists]
Advanced

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

condition to execute


From: lisa-asket
Subject: condition to execute
Date: Tue, 6 Jul 2021 05:52:28 +0200 (CEST)

From: David <bouncingcats@gmail.com>
To: help-bash <help-bash@gnu.org>
Subject: Re: condition to execute
Date: 06/07/2021 05:13:42 Europe/Paris

On Tue, 6 Jul 2021 at 13:00, <lisa-asket@perso.be> wrote:

> > > (( $f == 1 )) && source ${HOME}/.bashrc

> > A relatively minor consideration is that this list has a nonzero
> > exit status if f != 1. This suggests failure, even if it is not
> > actually a failure condition.

> What do you mean by a failure?

Restating what is written above:
"has a nonzero exit status"

Read about it here:
http://mywiki.wooledge.org/BashGuide/TestsAndConditionals#Exit_Status

Demo:
$ f=0; (( f == 1 )); echo $?
1
$ f=1; (( f == 1 )); echo $?
0

The exit status.  Do people always ensure exit status is correct?

When `f` is not `1`, I just print some help.




reply via email to

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