Monday, March 25, 2019

bash - How to combine these two commands?: ./script.sh > logfile.log and ./script.sh 2> logfile.log




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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...