Monday, August 24, 2009

using 2>&1

It's basically shell command for redirecting the standard error.
1. cat food 2>&1 >file
cat: can't open food
2. cat food >file 2>&1
In first command shell sees 2>&1 first and redirects the standard error(file descriptor 2)
to same place as standard outpur(file descriptor 1) goes ie STDOUT, while in second command
standard output goes to "file" so Standard Error(2) will also be redirected to same loaction
i.e.  to the "file"

No comments:

Post a Comment