|
Post by ZF on Nov 21, 2011 22:11:35 GMT -5
ls | grep -i "somefilename" 1> /dev/null if [ $? = 0 ];then #do something fi
$? stands for the output from previous instruction. note that if you echo after grep, $? after the echo command will be what the echo function returned.
1>/dev/null means that stdout is piped to /dev/null
2>/dev/null means that stderr is piped to /dev/null
cmd 2>&1 1>/dev/null means stderr is shown only
|
|