I can redirect stdout and stderr to a file like below
some_command.sh >> file.txt 2>&1
Can someone let me know how can I redirect stdout and stderr to a file and also to console?
I can redirect stdout and stderr to a file like below
some_command.sh >> file.txt 2>&1
Can someone let me know how can I redirect stdout and stderr to a file and also to console?
The tee
command can help you out. It reads from standard input and writes to standard output and files.
So the following command will do:
some_command.sh 2>&1 | tee file.txt