Quote:
Originally Posted by
jhullbuzz
@corona688 ok so it creates the output at the initial process call. what if i were to start it in the background with a logfile...is there a way to bring it into the FG?
I repeat: The shell cannot redirect output for a process that already exists. You can't just reach in and change a completely different process' file table for it.
The shell has to do all redirection for a new process
before the new process is run -- it does this by creating a subshell, which does all redirection, then
replaces itself with the new program but keeping I/O redirections intact. Once that's done, the new process controls its own output like any other program.
If you want to view the logfile as its written to, try 'tail -f logfile'. This will watch logfile for new lines and print them to standard output.
There's also the
screen terminal/utility/shell/thing, which uses network sockets to do something similar to you want. It keeps sessions that you can connect and disconnect to without killing or halting them.