|
Kansas State University at Salina Introduction to Unix |
|
Linux for Programmers and Users, Section 5.6.2 and 5.17
This rather peculiar metacharacter (<<) allows us to provide complex, multiline input to a command. Perhaps its most common usage is in a shell script used with the cat command to display a lengthy description to the user.
An example might illustrate its usage best:
$ cat << STOP
> Today, we hope that you learn a great deal about Unix.
> We are using Linux as our Unix system.
> There are many versions of Unix systems, including:
> UNIX, Solaris, BSD, AIX, HP-UX and Linux.
> References to UNIX, as it used to be spelled, are considered
> references to the UNIX from AT&T Bell Labs. Unix is a
> generic term refering to all Unix like systems.
> STOP
Today, we hope that you learn a great deal about Unix.
We are using Linux as our Unix system.
There are many versions of Unix systems, including:
UNIX, Solaris, BSD, AIX, HP-UX and Linux.
References to UNIX, as it used to be spelled, are considered
references to the UNIX from AT&T Bell Labs. Unix is a
generic term refering to all Unix like systems.
In the above example, the > characters at the beginning of each line are produced by the cat command, which is reading from standard input. Those characters will not be present in shell script.
Note