Wednesday, June 9, 2010

Bourne shell redirection

0 is stdin;
1 is stdout;
2 is stderr


redirect std err to file
$command 2>file

direct the output from command to stderr
$commamd >& 2

direct std output and std err to a file or /dev/null
$ command >file.log >>file.log
$ command >file.log 2>&1
$ command >/dev/null 2>&1

No comments: