APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2003/11/05 here file

© November 2003 Tony Lawrence

Bourne-like shells have an ability commonly referred to as "here files" or "here documents". A simple example is:

cat <<STUFF



Many programmers and scripters will use EOF as the marker, though what you use is entirely up to you.

Perl uses a similar syntax, the only real difference being the requirement for a terminating semicolon on the invoking line:

print <<EOF;



Perl can be a bit trickier about this than the shell can; see the Perl documentation for examples.

Probably the most creative use of "here" syntax is the "shar" program, which bundles files up into a self extracting shell script using here documents.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> here file

Inexpensive and informative Apple related e-books:

Take Control of the Mac Command Line with Terminal, Second Edition

Take control of Apple TV, Second Edition

Sierra: A Take Control Crash Course

Take Control of OS X Server

Take Control of Parallels Desktop 12

More Articles by © Tony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

If we define Futurism as an exploration beyond accepted limits, then the nature of limiting systems becomes the first object of exploration. (Frank Herbert)

Linux posts

Troubleshooting posts

This post tagged:



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode