wenclu
November 8, 2012, 7:45am
1
Hi,
I'd like to redirect the STDOUT output from my script to a file and simultaneously display it at a console.
I've tried this command:
myscript.sh | tail -f
However, it doesn't end after the script finishes running
I've also tried this:
myscript.sh | tee ~/results.txt
But it writes the output to the file not before the myscript.sh script finishes executing
Do you have any ideas?
Thanks in advance
hergp
November 8, 2012, 7:59am
2
On Linux, you can write
script -c myscript.sh -f out
The script command will run myscript.sh and write the output to the screen and to out
. The -f
option makes script flush the buffer after every line of output.
1 Like
wenclu
November 9, 2012, 3:59am
3
Thanks, it works fine
However, I work on the SunOS 5.10 so there is no possibility to run this command..
hergp
November 9, 2012, 3:08pm
4
Sun's implementation of script
does neither support the -c
nor the -f
option.