I have bash script:
echo "Hello world"
ls -la How to ask this script print stdout and stderr to info.log file?
How to ask this script print stdout and stderr to info.log file and screen?
1 Answer
You could run the script like so to redirect both stdout and stderr to the file.
./yourScript.sh > info.log 2>&1To redirect to a file as well as the console, you can use tee
./yourScript.sh 2>&1 | tee info.log 1