..MindWrite..

Posts Tagged ‘bash’

Output redirection: > /dev/null 2>&1

Posted by guptaradhesh on July 27, 2012

One would frequently notice this training redirect construct in many Unix commands – all it means is, ALL output from this command should be pushed into /dev/null.

> /dev/null 2>&1

/dev/null is a place where we can dump anything we don’t want to use. Since, 1 is stdout and 2 is stderr: 2>&1 can be interpreted as redirect stderr to stdout.  Thus, Error messages which go to stderr are redirected to stdout which is being redirected to dev/null. Therefore, no output at all.

 

Advertisements

Posted in tech, unix | Tagged: , , , , , | Leave a Comment »

Special parameters in UNIX Shell

Posted by guptaradhesh on October 24, 2010

$# Number of positional parameters

$? Exit value of last executed command

$$ Process number of current process

$! Process number of background process

$* All arguments on command line

“$@” All arguments on command line ,  individually quoted “$1” “$2” …

$-    Options currently in effect

Posted in tech | Tagged: , , , | Leave a Comment »