diff --git a/create_sympa_listdomain.sh b/create_sympa_listdomain.sh index ef1d5fa..d0d2b67 100755 --- a/create_sympa_listdomain.sh +++ b/create_sympa_listdomain.sh @@ -392,9 +392,6 @@ fi # - if multiple listmasers where given in a blank separated list, we correct it here # - -echo "" -echo "SYMPA_LISTMASTER: $SYMPA_LISTMASTER" -echo "" declare -a listmaster_arr=() for _listmaster in $SYMPA_LISTMASTER ; do listmaster_arr+=("$_listmaster") @@ -408,7 +405,11 @@ for _listmaster in "${listmaster_arr[@]}" ; do else SYMPA_LISTMASTER="${SYMPA_LISTMASTER},$_listmaster" fi -done +SYMPA_LISTMASTER="$(echo $SYMPA_LISTMASTER | sed 's/\(.\)\1*/\1/g')" +# Remove trailling ',' +SYMPA_LISTMASTER="${SYMPA_LISTMASTER%,}" +# remove leading ',' +SYMPA_LISTMASTER=${SYMPA_LISTMASTER#,} if grep -e "^\s*listmaster" $SYMPA_MAIN_CONF_FILE > /dev/null 2>&1 ; then