Put an Exit Code function in Scripts

To check the exit code of a process, test against the variable $?
Put an Exit Code function in Scripts:

rsync -avu /Folder1/ /Folder2/
if [ $? = 0 ]; then
     echo "The sync finished without an error!"
else 
     echo "The rsync had problems!!"
fi

Alternatively, do the same thing on one line:
rsync -avu /Folder1/ /Folder2/ && ( echo “Rsync Finished” | echo “Rsync had problems” )

This is a great resource and where this was taken from
Link:

1 thought on “Put an Exit Code function in Scripts”

  1. Yo, if you’re looking to get into 20Bet, 20betlogin.info is a good starting point. Helped me get in and start betting. The platform is pretty solid once you’re in. Good luck out there! 20betlogin

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Share via
Copy link