Redirect STDOUT Append File
STDOUT Append to File
Bash also provides a
STDOUT redirection append to file operator. In this case the contents of the existing file would not be overwritten, but instead a new line(s) would be added (append) at the end of the file.
Let’s try this out using the
echo "Hello, world!" >> hello-from-bash.txt
Output and Validation:
Similarly to the write redirection operator, the append operator created a new file and added the contents from
STDOUT to the file.
The difference is the file wasn’t overwritten with the contents of
This can be tested by executing another append redirection from bash:
echo "Good morning!" >> hello-from-bash.txt
Output and Validation
STDOUT redirect append operator simply added the text to the contents of the file.