Tuesday, October 14, 2008

/dev/null

http://topic.csdn.net/t/20020906/15/1002026.html
http://bbs.chinaunix.net/viewthread.php?tid=749535

check this link for the device usage.

1 - denotes stdout ( standard output )
2 - denotes stderr ( standard error )
/dev/null . apparently is null , nothing , empty , zero etc , etc .

2>/dev/null - redirect stderr to nothing , it turns stderr off.

>/dev/null 2>&1 also can write as 1>/dev/null 2>&1 - stdout redirect to /dev/null (no stdout) ,and redirect stderr to stdout (stderr gone as well) . end up it turns both stderr and stdout off

a little practice may help to undstand above .
#ls /usr /nothing
#ls /usr /nothing 2>/dev/null
#ls /usr /nothing >/dev/null 2>&1

No comments: