How to combine these two commands?
./script.sh > logfile.log
and
./script.sh 2> logfile.log
Thank you!
Answer
In bash, to redirect both standard output and standard error to the same file, you can write
./script.sh &> logfile.log
If you want to be compatible with other shells,
./script.sh > logfile.log 2>&1
No comments:
Post a Comment