Launch a script and redirect stderr and stdout to log files while still showing them in the terminal.
Any command with any number of parameters can be launched, stderr will be redirected to <cmd>.err and stdout to <cmd>.out (or specified paths with -e/-o). All output will still show in the terminal.
./teeoe [OPTION] command [args...] or teeoe [OPTION] command [args...]
A command must be provided. Shell builtins (e.g. history, cd) are not supported.
-eFilename for the stderr redirection (default:./<cmd>.err)-oFilename for the stdout redirection (default:./<cmd>.out)-lDirectory to write log files into (default: current directory)-cLog the full command and timestamp at the top of the output file
teeoe grep "string" file.txt # -> ./grep.out & ./grep.err
teeoe ./scripts/analysis/example.sh # -> ./example.out & ./example.err
teeoe -l logs/ ./run.sh -v # -> logs/run.out & logs/run.err
teeoe -l logs/ -e custom.err ./run.sh # -> logs/run.out & custom.err
teeoe -c -l logs/ ./run.sh -v # -> logs/run.out with command header & logs/run.err
The -c flag prepends the following header to the output file:
## Command: ./run.sh -v
## Date: 2026-03-25 14:32:01
<script output follows>
Arguments containing spaces are automatically wrapped in double quotes in the logged command, making it copy-pasteable.
Copy the teeoe file to your bin folder to execute it from anywhere, or run it directly with ./teeoe or bash teeoe.