I am running a script which looks like this.
#!/bin/bash
dat=$(date +%Y%m%d%H%M)
run_sim xmsclst gemm dcs s xec -post_min -d |& tee logx.$dat
The run_sim
is another csh
script and it calls make
program to run a long simulation.(A simulation envoling rtl files and gate-level model for our chip development). The problem I found is :
Normally, the simulation progress is displayed on the shell immediately as the simulation model prints something using the verilog's $display
system call. But if I use the above command, which is using pipeline
and tee
command, the text output is buffered somewhere and it is not seen on the screen right away so I cannot know the status of the simulation. Only when I press ctrl-C to stop the simulation, then come out the buffered display lines on the screen, but then I cannot resume my simulation, because it's already stopped. I know if I don't use the pipeline and tee command, I could see the output as the simulation progresses But I have already started the simulation and it's already passed more than 2 hours and I don't have much time for repeating this simulation process today.
Is there any way I can see the simulation progress without killing the simulation? and hopefully without killing the tee
process? (Having asked this, I think maybe I can kill just the tee
process and the text may come out normally again.)
I found [this][1] . So the correct way is :
This
unbuffer
command makes the following program's output not buffered. so you can see the output as soon as it is generated. I found this works. But I couldn't apply this without killing the on-going process. Killing only thepipe
process didn't make the buffered output come out. [1]: https://stackoverflow.com/questions/11337041/force-line-buffering-of-stdout-in-a-pipeline