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

Reply via email to