Sysadmin > UtilitIes > HereDocuments

Here documents or heredoc

Multi-line message using cat

#!/bin/sh
cat << FOOBAR123
Line 1
Line 2
Line 3
FOOBAR123

Multi-line message using cat, with tabs suppressed

#!/bin/sh
cat << -FOOBAR123
   Line 1
   Line 2
   Line 3
FOOBAR123

Multi-line message using cat, with replaceable parameters

#!/bin/sh
NAME=Hugo
cat << FOOBAR123
Line 1
Name is $NAME
Line 3
FOOBAR123

Multi-line message using cat, with parameters turned off

#!/bin/sh
cat << 'FOOBAR123'
Line 1
Name is $1
Line 3
FOOBAR123