I'm testing out a way to run a process separate from the original process in sh.
I've already asked and heard that & is used for spawning a child process.
By calling a program, in this case glxgears, because it has a lot of STDOUT (so I can test where output goes), using backticks.
glxgears&
does not keep output out of the current shell where
`glxgears`&
causes
comp:~ user$ `glxgears`&
[1] 14511
comp:~ user$ X connection to /tmp/launch-dZalNv/org.x:0 broken (explicit kill or server shutdown).
[1]+ Exit 1 `glxgears`
comp:~ user$
I accept that **`[1] 14511`** is just notification of proper process launch, but how is the X Server still **able** to dump output in my shell?
And why if I have launched a separate process is
[1]+ Exit 1 `glxgears`
Showing up? The shell never warns me of other closing processes!
I think I've deduced that it may have to do with the process group which remains the PID of my shell even after my shell is closed. All other processes have their own process group.
Even using
`glxgears&`&
retains the original shell's PID as the process group!
I want to be able to run a program (in this case glxgears) without any association to the launching shell, no output of any kind.
If you could also explain why the X server can send my starting process the output that be very much appreciated. As an aside, that is not what you use backticks for. Once the process produces some output, the shell will attempt to use the first word of output as a command name to execute. Behold: `echo moo` -> sh: moo: command not found
以上就是What can be used to spawn a completely seperate process in Bourne Shell (Or csh)的详细内容,更多请关注web前端其它相关文章!