pipe multi-line string into file 1

pipe multi-line string into file

# possibility 1:
echo "line 1" | sudo tee -a greetings.txt > /dev/null

# possibility 3:
sudo tee -a greetings.txt > /dev/null <

Here is what the above code is Doing:
1. The first line is a simple echo command.
2. The second line is a bit more complicated. It's using the tee command to write the output of the echo command to a file. The -a flag tells tee to append the output to the file instead of overwriting it. The > /dev/null part tells tee to send its output to /dev/null, which is a special file that discards all data written to it.
3. The third line is similar to the second line, but instead of using the echo command, it's using a here document to write multiple lines to the file.

Similar Posts