Currently I am running the bash script like this:
$ myscript.sh param1 param2 param3 >log.txt
and it is outputting the normal information.
My question is:
how can I output all normal and error information (in, out, err) to a log file from within the script itself?
my try is the following but it is not working:
#!/bin/bash
exec 2>&1
{
mycommand1
mycommand2
mycommand3
} 2>&1 | tee -a /tempfolder
logdir=$(mktemp -d);exec 1>"$logdir"/log 2>&1
– Mar 29 '17 at 14:27