Input and Output

When you write shell scripts, you want to be able to obtain input from sources outside your scripts; for example, from another file or from keyboard input. You also want to be able to generate output both for use within the script and for display on-screen.

The following sections describe how to control input and output of a shell script, using standard input, output, error, and redirection; how to accept user input (input from the keyboard) to a script; how to create “here” documents; and how to generate output to the screen.

Standard In, Standard Out, and Standard Error

When writing shell scripts, you can control input/output redirection. Input redirection forces a command to read any necessary input from a file instead of ...

Get Solaris™ 8 Advanced System Administrator's Guide, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.