Shell Script: How to write a string to file and to stdout on console? February 5, 2023 by Tarik Use the tee command: echo "hello" | tee logfile.txt