PDA

View Full Version : Hey Guys little help



Mohan1289
December 1st, 2012, 02:41 PM
Hi guys in the screen shot that guy used a command



./test.shh 2>&1 |tee test.log


what's the use of 2>&1 and why he has to use that ??

steeldriver
December 1st, 2012, 02:50 PM
2>&1redirects the standard error stream (stream 2) into the standard output stream (stream 1) - so error messages get combined with any other output from the command

zombifier25
December 1st, 2012, 02:53 PM
A little Googling gave me this:
http://stackoverflow.com/questions/818255/in-the-bash-shell-what-is-21
Basically, 2>&1 means "redirect all output from stderr to stdout".
EDIT: Ninja'd!

Mohan1289
December 1st, 2012, 02:57 PM
A little Googling gave me this:
http://stackoverflow.com/questions/818255/in-the-bash-shell-what-is-21
Basically, 2>&1 means "redirect all output from stderr to stdout".
EDIT: Ninja'd!

Thanks

Mohan1289
December 1st, 2012, 03:05 PM
A little Googling gave me this:
http://stackoverflow.com/questions/818255/in-the-bash-shell-what-is-21
Basically, 2>&1 means "redirect all output from stderr to stdout".
EDIT: Ninja'd!

Thanks Guys