From 73dcfc381c57b215e073b564d1647198411f5186 Mon Sep 17 00:00:00 2001 From: Juan Luis Baptiste Date: Mon, 23 Mar 2020 18:30:00 -0500 Subject: [PATCH] Fix awk expression, it worked before because of a bug, it does not work with more recent awk versions. --- run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run.sh b/run.sh index 7473646..a57aaca 100644 --- a/run.sh +++ b/run.sh @@ -5,7 +5,7 @@ function add_config_value() { local key=${1} local value=${2} - local config_file=${3:-/etc/postfix/main.cf} + # local config_file=${3:-/etc/postfix/main.cf} [ "${key}" == "" ] && echo "ERROR: No key set !!" && exit 1 [ "${value}" == "" ] && echo "ERROR: No value set !!" && exit 1 @@ -21,7 +21,7 @@ function add_config_value() { SMTP_PORT="${SMTP_PORT-587}" #Get the domain from the server host name -DOMAIN=`echo ${SERVER_HOSTNAME} |awk -F. '{$1="";OFS="." ; print $0}' | sed 's/^.//'` +DOMAIN=`echo ${SERVER_HOSTNAME} | awk 'BEGIN{FS=OFS="."}{print $(NF-1),$NF}'` # Set needed config options add_config_value "myhostname" ${SERVER_HOSTNAME}