Monday, August 18, 2008

Redirect the standard error

There are three I/O streams available in Unix.
1. STDIN (0)
2. STDOUT (1)
3. STDERR (2)

To redirect the error to a file

ls -l doesnotexist 2>err.txt

Example:
ls -l exp 1>result.txt 2>error.txt
This command outputs the standard output into the file called result.txt and the standard error to the file called error.txt.

No comments: