I have a script, I am able to send the output of the script to both the screen and a file as shown below
./script | tee -a temp.log
I wonder is it possible to achieve same thing by executing some commands inside the script.
As for other users, who execute the script it is not advisable to pipe the output of script with the help of tee command.
Again, keeping |tee
at the end of every line of the script doesn't seem to be advisable. I tried with this for couple of lines and it works.
Is it possible to get the output of script to both screen and file by just executing name of the script, with some script tweaking ?