我有一个 bash 脚本,它在后缀 main.cf 文件中回显
IPADD=$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')
cat << EOG > /etc/postfix/main.cf
# LOCAL PATHNAME INFORMATION
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
# QUEUE AND PROCESS OWNERSHIP
mail_owner = postfix
# SENDING MAIL
myorigin = $mydomain
# RECEIVING MAIL
mydestination = $myhostname localhost.$mydomain localhost $mydomain
# TRUST AND RELAY CONTROL
mynetworks_style = host
smtp_bind_address = $IPADD
inet_interfaces = $IPADD, 127.0.0.1
EOG
问题是,一旦您运行脚本,它就会从以下位置删除“$mydomain”:
# SENDING MAIL
myorigin = $mydomain
并且还去掉了“$myhostname”和“$mydomain”
# RECEIVING MAIL
mydestination = $myhostname localhost.$mydomain localhost $mydomain
我希望 $IPADD 能够工作和运行,但希望它忽略 $mydomain 和 $myhostname 前面的“$”。
这可能吗?