1 |
On Tue, 2 May 2006, Zac Slade wrote: |
2 |
|
3 |
> You can find the PID of the last backgrouned process using the bash variable |
4 |
> $! |
5 |
> |
6 |
The child is not backgrounded! |
7 |
> So something like: |
8 |
> subprocess & |
9 |
> $pid=$! |
10 |
> |
11 |
> Using trap along with maybe setting alarms should get you what you want. |
12 |
> |
13 |
Based on the suggestions of Uwe and Vladimir, I tried |
14 |
trap 'pkill -TERM -P $$; kill -s TERM $$' TERM |
15 |
<do something> |
16 |
. /path/to/child.sh |
17 |
<do something else> |
18 |
Doesn't work, yet. Note that child.sh is a shell script that may execute |
19 |
some other command (like rsync), so the "." by itself may not be enough. |
20 |
|
21 |
Thanks everyone. |
22 |
|
23 |
|
24 |
Jorge |
25 |
-- |
26 |
gentoo-user@g.o mailing list |