On 1/2/12 1:38 PM, Stas Sergeev wrote: > 02.01.2012 22:27, Chet Ramey wrote: >>> In this case it would be nice for bash to have >>> a signal that will move the background process >>> to the foreground. >> But there is already a command to do that: fg. > Sorry, mistyped, I meant the other way around: move > the foreground process to the background, then finish > the script, leaving the process alive.
The SIGSTOP/SIGCONT works to put the process into the background: the jobs pgrp is not the same as the terminal's pgrp. If you don't want the shell to terminate the job at exit because it's stopped, use `disown' after the job stops to have the shell forget it while you continue it from another process. > Will your suggestion about the trap handler work > also for ^Z+bg rather than just fg? It should. I know that `cat' was just an example, but you have to make sure the job you want to stop/continue is not attempting to read from the terminal. If it is, the kernel will SIGTSTP it every time. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/