diff --git a/target/scripts/helper-functions.sh b/target/scripts/helper-functions.sh index f136c650..98653f14 100755 --- a/target/scripts/helper-functions.sh +++ b/target/scripts/helper-functions.sh @@ -316,8 +316,8 @@ function _obtain_hostname_and_domainname DOMAINNAME="${DOMAINNAME:-${HOSTNAME}}" } -# Remove string input with empty line, only whitespace or `#` as the first non-whitespace character. -function _strip_comments +# Check if string input is an empty line, only whitespaces or `#` as the first non-whitespace character. +function _is_comment { grep -q -E "^\s*$|^\s*#" <<< "${1}" } diff --git a/target/scripts/helpers/relay.sh b/target/scripts/helpers/relay.sh index 908d82ba..ab57f33c 100755 --- a/target/scripts/helpers/relay.sh +++ b/target/scripts/helpers/relay.sh @@ -28,7 +28,7 @@ function _relayhost_sasl # add domain-specific auth from config file: while read -r LINE do - if ! _strip_comments "${LINE}" + if ! _is_comment "${LINE}" then echo "${LINE}" >> /etc/postfix/sasl_passwd fi