Display correct return code
This commit is contained in:
parent
605408d619
commit
141f9bd535
2 changed files with 11 additions and 2 deletions
|
@ -417,8 +417,10 @@ while [ "$i" -lt "$no_sources" ]; do
|
|||
rsync $ouropts $useropts "$source" "$abs_destination_dir"
|
||||
fi
|
||||
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "rsync reported error $?. The backup may be broken (see rsync errors)."
|
||||
ret=$?
|
||||
|
||||
if [ "$ret" -ne 0 ]; then
|
||||
echo "rsync reported error $ret. The backup may be broken (see rsync errors)."
|
||||
fi
|
||||
|
||||
echo "$($DDATE) Finished backup"
|
||||
|
|
|
@ -14,3 +14,10 @@ if [ "$ret" -ne 0 ]; then
|
|||
echo "$ret"
|
||||
fi
|
||||
|
||||
# if is true, ls is fales
|
||||
if [ "foo" = "foo" ]; then
|
||||
ls /surely-not-existent$$ 2>/dev/null
|
||||
fi
|
||||
|
||||
# but that's still the return of ls and not of fi
|
||||
echo $?
|
||||
|
|
Loading…
Reference in a new issue