Saturday, June 30, 2012

output redirection

0 means stdin, 1 means stdout, 2 means stderr

$ echo 'X' 1>/dev/null    #output nothing
$ echo 'X' 2>/dev/null    #output  X
$ echo 'X' 1>&2             #output  X
$ echo 'X'  >/dev/null    2>&1 #output nothing stdout is redirected to /dev/null, stderr is also redirected what stdout is going to(that is /dev/null), this is equivlent to following red-colored command:
$ echo 'X' 1>dev/null 2>/dev/null

No comments:

Post a Comment