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


Groups > gnu.bash.bug > #15062

Re: How to tell Bash multiple values are success?

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: How to tell Bash multiple values are success?
Date 2019-06-19 11:08 -0400
Message-ID <mailman.459.1560957020.10840.bug-bash@gnu.org> (permalink)
References <CAH8yC8nj-JmJH_C+=6EPy7JmgG7JsOyx973DdMF6kTpcVAcZRg@mail.gmail.com> <20190619150820.GT2072@eeg.ccf.org>

Show all headers | View raw


On Wed, Jun 19, 2019 at 11:01:46AM -0400, Jeffrey Walton wrote:
>     if dnf -y update &>/dev/null
>     then
>         echo "Upgraded system"
>     else
>         echo "Failed to upgrade system"
>         exit 1
>     fi
> 
> The problems seems to be 0, 100 and 200 are success. When updates are
> installed either 100 or 200 is returned. Confer,
> https://dnf.readthedocs.io/en/latest/command_ref.html .

dnf -y update >/dev/null 2>&1
rc=$?
case $rc in
  0|100|200) echo "Upgraded system";;
  *)         echo "Failed up upgrade system"; exit 1;;
esac

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


Thread

Re: How to tell Bash multiple values are success? Greg Wooledge <wooledg@eeg.ccf.org> - 2019-06-19 11:08 -0400

csiph-web