From 22675d1be3330f49d425cc5576e123b7265de288aa6c361b77cc7b7385d4725e Mon Sep 17 00:00:00 2001 From: Thomas Oettli Date: Sat, 22 Aug 2026 05:31:27 +0200 Subject: [PATCH] fix error handling --- pbc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pbc b/pbc index 00b1769..4b48b18 100755 --- a/pbc +++ b/pbc @@ -43,12 +43,13 @@ function full_usage() { } function pbc-version() { - local vers_info=$("$PBC" version) - local rc=$? - (( $rc != 0 )) && echo "Error running $PBC version ... exited with rc=$rc" >&2 && return $rc + local vers_info rc + vers_info=$("$PBC" version) + rc=$? + (( rc != 0 )) && echo "Error running $PBC version ... exited with rc=$rc" >&2 && return $rc echo "$vers_info" | grep client rc=$? - (( $rc != 0 )) && echo "Error reading client version, output was:" >&2 && echo "$vers_info" >&2 + (( rc != 0 )) && echo "Error reading client version, output was:" >&2 && echo "$vers_info" >&2 return $rc } @@ -116,8 +117,8 @@ function install_proxmox_backup_client() { ! $installed && update=false if $installed && ! $update; then - local version=$("$PBC" version | head -n 1) - (( $? != 0 )) && echo "Error running $PBC version: exited with rc=$?" >&2 && return 10 + local version + version=$(pbc-version) || return 10 echo "Info: skip installation of proxmox-backup-client, already installed ($version)" return 0 fi