Tuesday, March 22, 2011

>/dev/null 2>&1" and "&> /dev/null does the same job

We all know that /dev/null is the 'bit bucker' or the 'black hole' (nothing but a special file
that discards all data written to it)

Background:

We also know the standard streaming conventions: STDIN(0) STDOUT(1) and STDERR(2)

&>filename =

Redirect both stdout and stderr to file "filename."

2>&1
# Redirects stderr to stdout.
# Error messages get sent to same place as standard output.

Now lets analyze:

>/dev/null 2>&1"
: This means that standard output goes to /dev/null and
standard error(2) should get redirected to where your standard output
is going(in our case it is /dev/null)

&> /dev/null
: As explained above, redirect standard output(1) and standard error(2)
to /dev/null


So coders and SA's this is actaully same and dont get(urself) and try
make other confused with this please :P

More you can read here

-DEBA

No comments:

Post a Comment

'Optimism Bias' leads to poor decision making!

Effective Time-management and Time-boxing is a concern for 'always ready people'.  Being from a background that I am from,  I am...