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


Groups > gnu.bash.bug > #15061 > unrolled thread

How to tell Bash multiple values are success?

Started byJeffrey Walton <noloader@gmail.com>
First post2019-06-19 11:01 -0400
Last post2019-06-19 11:01 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  How to tell Bash multiple values are success? Jeffrey Walton <noloader@gmail.com> - 2019-06-19 11:01 -0400

#15061 — How to tell Bash multiple values are success?

FromJeffrey Walton <noloader@gmail.com>
Date2019-06-19 11:01 -0400
SubjectHow to tell Bash multiple values are success?
Message-ID<mailman.458.1560956539.10840.bug-bash@gnu.org>
Hi Everyone,

I have a systemd service that automatically applies updates. Looking
at the service history, the service reports failure when it installs
updates due to this:

    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 .

I looked through Bash Variables, but I did not see a way to signal the
information to Bash. Confer,
https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html
.

How do I tell Bash 0, 100 and 200 are success? (Or, how to tell Bash 1
is the only failure?)

Thanks in advance

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web