![bash - Display stdout and stderr to both console and file, color stderr red and display stdout and stderr as they are being produced - Stack Overflow bash - Display stdout and stderr to both console and file, color stderr red and display stdout and stderr as they are being produced - Stack Overflow](https://i.stack.imgur.com/6ZwXv.png)
bash - Display stdout and stderr to both console and file, color stderr red and display stdout and stderr as they are being produced - Stack Overflow
![Jonas Berlin on Twitter: "How to pipe stdout & stderr of a #bash script both to stdout and to a file: exec 3>&1 coproc tee -a logfile >&3 trap "exec >&3 2>&3 { Jonas Berlin on Twitter: "How to pipe stdout & stderr of a #bash script both to stdout and to a file: exec 3>&1 coproc tee -a logfile >&3 trap "exec >&3 2>&3 {](https://pbs.twimg.com/media/EajOaICWsAAsRUx.jpg)
Jonas Berlin on Twitter: "How to pipe stdout & stderr of a #bash script both to stdout and to a file: exec 3>&1 coproc tee -a logfile >&3 trap "exec >&3 2>&3 {
![Bash - Redirect both standard output and standard error to same file - Linux Tutorials - Learn Linux Configuration Bash - Redirect both standard output and standard error to same file - Linux Tutorials - Learn Linux Configuration](https://linuxconfig.org/wp-content/uploads/2013/04/01-bash-redirect-both-standard-output-and-standard-error-to-same-file.png)