#!/bin/bash PROFIL="${1}" IS_AUTO="${2}" if [ ! -e "$HOME/.unison/${PROFIL}.prf" ] then echo "Le profil ${PROFIL} n'existe pas" >&2 exit 1 fi ROOT=$(grep -r "^root *=" $HOME/.unison/${PROFIL}.prf | sed -e 's/^root *= *//') for dossier in ${ROOT} do if [ ! -x "${dossier}" ] then if [ -z "${IS_AUTO}" ] then echo "Le dossier ${dossier} n'est pas lisible" >&2 exit 1 else exit 0 fi fi done if [ -z "${IS_AUTO}" ] then unison -ui text "${PROFIL}" else nodeletion=$(grep -r "^root *=" $HOME/.unison/${PROFIL}.prf | sed -e 's/root *=/-nodeletion/') unison -ui text -silent -batch $nodeletion "${PROFIL}" fi