I have a script which uses rsync to sync data in a remote -> local scenario. Immediately after the rsync command is run, a check to see if the error code equals zero or not. If its zero, further commands are performed. This however doesn't take into account the fact that rsync might have ran successfully but not actually made any changes. Because of this the equal zero condition will run regardless, which is a little redundant.
rsync -aEivm --delete /path/to/remote/ /path/to/local/
if [ $? -eq 0 ]; then
# Success do some more work!
# Something went wrong!
What would be the best approach to expand this to check if there were actually any changes based on the rsync command that ran. I've read that -i flag can provide output to stdout, but how can this be placed in a conditional block?