From a8a39a0a1a4df5a90eb54b14aaee0ba389041115 Mon Sep 17 00:00:00 2001 From: Casper Date: Sun, 28 Nov 2021 17:02:07 +0100 Subject: [PATCH] Rename function and adjust comment (#2306) --- target/scripts/helper-functions.sh | 4 ++-- target/scripts/helpers/relay.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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