Unix tools introduced. Today: cat

cat is a well known command to concatenate the content of multiple files.  Example: cat file1 file2 file3

But there are other use cases. cat offers a nice way to print out multi line strings.  It is even possible to include variables into the string, which feels a little bit like using a templating language.

Example:

NAME=ADMIN@COMPANY.COM;
cat <<EOF
Hello $LOGNAME,
please be aware. This system will be under maintenance soon.
Have a good day.
Sincerely
$NAME
EOF

For more info on the <<EOF visit this SO-Thread

 

 

Leave a Reply