I have a job in Jenkins with a shell script that I want to save its output to a file and in the same time print to console, is that possible?
The shell script is doing docker login
and docker run
(this will pull the image too) and I want the output to be saved into a file and also printed in real time (printing the file content later on won't have the same effect)
Can someone assist?
Use tee
.
<command> 2>&1 | tee output.log
eg:
./docker_exec.sh 2>&1 | tee output.log