script: unison echo message only on errors

This commit is contained in:
Mathieu Maret 2018-05-24 13:47:44 +02:00
parent 62b4c4eaa5
commit f75d291791

View File

@ -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