append text to end of file with cat

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)

append to end of file with cat1 append text to end of file with cat  

append text to end of file with cat

append to end of file with cat2 append text to end of file with cat

Q: What is this magical feature?

A: Here Documents

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>