Skip to Main Content
Expert Shell Scripting
book

Expert Shell Scripting

by Ron Peters
December 2008
Intermediate to advanced content levelIntermediate to advanced
320 pages
6h 45m
English
Apress
Content preview from Expert Shell Scripting

CHAPTER 9Data Redirection

Data redirection is when the input or output of a command is redirected using special notation. It is also used for opening and closing files for read and write operations. The forms and syntax of redirection are varied and their meanings are specific. I will cover some of the common uses here, and provide a bit more explanation than system man pages to aid you in avoiding pitfalls.

Avoiding Confusion

Data redirection is a common point of confusion among users. Problems with its usage arise most often when a user wants to set up a cron job that sends all its output to /dev/null, such as in the following crontab entry:

10 5 * * * /run/some/script > /dev/null 2>&1

In this example, all of the output will be sent to /dev/null ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Robust Shell Scripting

Robust Shell Scripting

Arnold Robbins
Hacker Techniques, Tools, and Incident Handling

Hacker Techniques, Tools, and Incident Handling

Sean-Philip Oriyano, Michael Gregg

Publisher Resources

ISBN: 9781430218418Purchase book