I have a program, let is call it
xcommand. when it is running, it has no stdout, but it writes its output to a file.
What I want to a achieve is like this: After I running
xcommand, during its running I want to see its output in real time, and if I found something abnormal, I then turn off the output and at the same time, bring back
I tried several ways, for example in the bash script I write
xcommand & tail -f outputfile fg
However, the problem is as soon as I press
ctrl+c, the whole thing is stopped. And
fg is not running at all.
So is it possible to achieve what I want?