#!/bin/bash readarray -t domains < /mail_settings/domains first_fqdn="\$myhostname = \"${domains[0]}\";" domain_string=$(printf "'%s' " "${domains[@]}") | tr ' ' , domain_acl="@local_domains_acl = ( $domain_string );" sed "/# DOCKERMAIL DOMAINS START/,/# DOCKERMAIL DOMAINS END/{//!d}" /etc/amavis/conf.d/05-node_id -i sed "/# DOCKERMAIL DOMAINS START/,/# DOCKERMAIL DOMAINS END/{//!d}" /etc/amavis/conf.d/50-user -i sed "/# DOCKERMAIL DOMAINS START/a $first_fqdn" /etc/amavis/conf.d/05-node_id -i sed "/# DOCKERMAIL DOMAINS START/a $domain_acl" /etc/amavis/conf.d/50-user -i