> I run a script, and so Bash runs non-interactively. In the script I > run some commands with: > > > some_command & > > My script is run by a process which doesn't have a controlling > terminal, and so my script doesn't inherit the terminal. > > I want Bash to kill the commands that I run when my script exits. The > option "huponexit" doesn't work for me because Bash runs > non-interactively. How can I achieve my goal?
Since it's a script, all processes are in the same process group. Depending on your system (most accept this), you could do something like trap 'kill -s HUP 0' 0 I'm assuming that you're running the script from a job control shell, and that the process group of the jobs run from the script is the same as the script's pid. If that's the case, you should be able to do something like: trap 'kill -s HUP -$$' 0 in the script as well. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ( ``Discere est Dolere'' -- chet ) Live...Laugh...Love Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://tiswww.tis.case.edu/~chet/ _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash