Output to standard out AND a file at the same time

Let’s say you’re running a script, and you want the output to show up in the terminal and be output to a file simultaneously. This is how to do that:

<your-command-here> | tee <output-file>

Example:

./myscript.sh | tee out.txt