Mastering Redirection in BASH on Linux
Sending Your Inputs and Outputs Where They Belong
Bash has three standard file descriptors: stdin, stdout and stderr, which refer respectively to input, output and error output. By default, all of these are directed to the terminal, so all input comes from the terminal, and all output (regular and error) will go to the terminal.
You're probably already familiar with redirecting stdin and stdout:
process.pl < datain.txt > dataout.txtTo redirect stderr, you must be more specific:
/etc/init.d/apache2 2> errors.txtOften, you want to redirect both stdout and stderr to the same file, and there are two ways of doing that:
Read the rest of this Linux BASH story at ServerWatch.com
Sponsored by BlackBerry
BlackBerry® Enterprise Server Express enables businesses of any size to quickly and easily get started with the BlackBerry solution. It provides advanced BlackBerry smartphone features with no additional software or user license fees, and works with any Internet-enabled BlackBerry data plan or a BlackBerry enterprise data plan. Download now!