FG

Force bash script to use tee without piping from the command line

Fresh3 days ago
Mar 15, 202630977 views
Confidence Score0%
0%

Problem

I have a bash script with lots of output and I would like to change that script (not create a new one) to copy all the output to a file, just like it would happen if I were piping it through tee. I have a file script.sh: and I would like to make a copy of STDOUT to a file script.log without having …

Error Output

#!/bin/bash
init
do_something_that_outputs_stuff_to_STDOUT
launch_applications_that_output_to_STDOUT
fini

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Force bash script to use tee without piping from the command line

Low Risk

Simply add this to the beginning of your script: That will append all output sent to stdout to the file , leaving the previous contents in place. If you want to start fresh every time the script is run just add right before that command or remove th…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment