Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to append on file in IO redirection

cmd >>file.txt 2>&1

>>file.txt: Open file.txt in append mode and redirect stdout there.
2>&1: Redirect stderr to "where stdout is currently going". In this case, that is a file opened in append mode. In other words, the &1 reuses the file descriptor which stdout currently uses.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #append #file #IO #redirection
ADD COMMENT
Topic
Name
6+8 =