1

postfix main.cf ファイルにエコーする bash スクリプトがあります。

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 の前の「$」を無視したいと考えています。

これは可能ですか?

4

2 に答える 2

3
cat << 'EOG' > /etc/postfix/main.cf
# other stuff
myorigin = $mydomain
# other stuff
EOG

ヒアドキュメント

于 2013-05-03T09:29:34.610 に答える