# Use tee to read from standard input and write to standard output and files. echo "hello" | tee -a file1 file2 or # can flip it around for heredoc: tee -a aaa bbb ccc << EOF contents ... EOF