I know that I can [save the output to a variable](https://stackoverflow.com/questions/4651437/how-to-set-a-variable-to-the-output-of-a-command-in-bash) and *then* print it:

```
VAR=$(command)
echo "$VAR"

```

But this has a number of drawbacks: 

* I won't see the progress of the command as it goes.
	+ In particular, will see all `stdout` output after all `stderr` output, making it hard to match them.
* Since this will result in no output for the duration of the command's work, in some environments (like Travis CI) this will terminate the job if the command works for long enough.

**So, how can I save the output and also see it live on the console?**

* Portable solutions are preferrable though a Linux/MacOS-only one will do in a pinch.
* A solution should not have undesirable side effects in `errexit` mode