Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

More on LinuxToday


Shell Scripts and Here Documents

Jan 26, 2010, 12:04 (0 Talkback[s])
(Other stories by Juliet Kemp)

"A here document (or heredoc) is a way of getting text input into a script without having to feed it in from a separate file. If you've got a small quantity of data you don't expect to change often, it's a quick and tidy way of keeping script and data together. For more complicated data or scripts, separating the two is still usually a better idea.

"The basic version of this in bash looks like this:

#!/bin/bash
cat << EOF
several lines of 
my data
listed here
EOF

"which will output

several lines of 
my data
listed here

Complete Story

Related Stories: