Shell Scripts and Here Documents
Jan 26, 2010, 12:04 (0 Talkback[s])
(Other stories by Juliet Kemp)
WEBINAR:
On-Demand
How to Help Your Business Become an AI Early Adopter
"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: