I have a script that rsyncs and ends like this
rsync -azvh /dir -e ssh [email protected]:/
RESULT="$?"
# check result of rsync db's
if [ "$RESULT" != "0" ]; then
echo -e "rsync exit Code:" $RESULT "\nFAILED to rsync backups"
else
echo "SUCCESSFULL rsync of backups"
fi
I have just been asked to wrap it in an API but the API states that 0=fail
and 1=success
. How can I change the exit code to reflect this? Do I need to assign it a variable?
set -e
, with make, ... – Gilles 'SO- stop being evil' Nov 4 '16 at 23:15