Bash ignore the $

I have a bash script which echo's in a postfix main.cf file

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

The problem is once you run the script, it strips out the "$mydomain" from:

 # SENDING MAIL
    myorigin = $mydomain

And also strips out the "$myhostname" and "$mydomain" from

# RECEIVING MAIL
    mydestination = $myhostname localhost.$mydomain localhost $mydomain

I would like the $IPADD to work and run, but would like it to ignore the "$" infront of $mydomain and $myhostname.

Is this possible?

Answers


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

Here Document


Need Your Help

Cywgin Sed match not working when “/” in string

regex bash sed special-characters

testLine="This is a test line: Asia/Pacific Australia"

How to calculate a drop rate based on percentage

java math

I was torn between posting here and math.stackexchange.com but opted for here as it's equally programming related and I've not used math.stackexchange.com before.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.