append text to end of file with cat

January 17, 2013
Overwrite File with multi-line text

Objective: Append multiline text with cat

Examples

Replace contents of /etc/apache2/mods-available/geoip.conf

cat <<'EOF' > /etc/apache2/mods-available/geoip.conf
<IfModule mod_geoip.c>
  GeoIPEnable On
  GeoIPScanProxyHeaders On
  GeoIPDBFile /opt/modsecurity/etc/GeoIP.dat MemoryCache
</IfModule>
EOF

Tell log rotate to start rotating the http log (this overwrites any existing file)

Overwrite File with multi-line text  

append text to end of file with cat

append text to end of file with cat

Q: What is this magical feature?

A: Here Documents