Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

2>&1 linux pipe stderr, stdin, stdout

echo test > afile.txt
#redirects stdout to afile.txt. This is the same as doing

echo test 1> afile.txt
#To redirect stderr, you do:

echo test 2> afile.txt
#So >& is the syntax to redirect a stream to another file descriptor:

0 is stdin
1 is stdout
2 is stderr
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #linux #pipe #stdout
ADD COMMENT
Topic
Name
7+4 =