Corrected error checking for rsync, syntax errors and changed to use tac