From f75d291791f575dc83dc3de9deba3f763e3ddd25 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Thu, 24 May 2018 13:47:44 +0200 Subject: [PATCH] script: unison echo message only on errors --- scripts/unison_backup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/unison_backup.sh b/scripts/unison_backup.sh index 2852e4b..6fbcaf8 100755 --- a/scripts/unison_backup.sh +++ b/scripts/unison_backup.sh @@ -3,13 +3,13 @@ tmp_file=$(mktemp) for profile in $@; do - res=$(${unison_exe} -batch $profile > ${tmp_file} 2>&1) - grep "Nothing to do: replicas have not changed since last sync" ${tmp_file} > /dev/null + res="$(${unison_exe} -batch $profile > ${tmp_file} 2>&1)" file_sync=$? - if [ ! $file_sync == 0 ]; + if [ "$file_sync" -ne "0" ]; then - echo $(more ${tmp_file}) + echo "return code $file_sync" + more ${tmp_file} fi done