> rsync <options> > if ! $? ; then > echo -e "\nrsync completed successfully!\n" > else > echo -e "\nrsync failed!\n!" > fi BTW, it's legit (and sometimes clearer) to do it like this: if rsync <options> then echo -e "\nrsync completed successfully!\n" else echo -e "\nrsync failed!\n!" fi