Display the output on the terminal and tail the last 10 lines to log file

Viewed 11242

I need to run a script and output the full contents to the terminal. I then want to get the last 10 lines from the terminal output and put them in a log file. I have tried using ./script.sh 2>&1 | tail -10 > log.log but this stops the output to the terminal.

2 Answers
Related