Tee Suppressing Progress Bar in Shell Script Tee Suppressing Progress Bar in Shell Script shell shell

Tee Suppressing Progress Bar in Shell Script


In general, well-written programs with content such as progress bars suppress such interactive content when writing to a FIFO (or, more generally, to a FD without an associated TTY) to make their logs easier to read or parse, which is why piping to tee is having the effect that it is. (Programs which use stderr rather than stdout for their progress bars might be more resistant, disabling the bar only when stderr is a non-TTY display).

If you want to fake having a TTY, tools such as EmPTY can do this. However, this will mean that all the progress-bar-related cruft will end up in your log file, which can make it both large and difficult to read or parse.

Unfortunately, you can only have it both ways (progress bar to the TTY, non-bar content including stderr to a file) if the software you're running was explicitly written to allow that, which is rarely done if ever.


Sometimes you want to see the progress bar anyway. ie: if your program is using tee, but it's actually running on an interactive shell.

To do that use script instead of tee

script -c 'yourcommand' <some_log_file>

This way you will be able to capture the output in a file and ALSO see the progress bar (like the current progress when docker is pulling images).

Documentation: https://www.man7.org/linux/man-pages/man1/script.1.html

This is how I found out:https://forum.restic.net/t/how-to-get-verbose-progress-updates-but-also-log-with-tee/2825/2