Results 1 to 3 of 3
I have a script that starts a subshell
Code:
#!/bin/sh
local SSPID
clean_exit() {
#here the subshell shall be killed
exit 0
}
trap clean_exit INT TERM EXIT
while true
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-21-2010 #1Just Joined!
- Join Date
- Nov 2010
- Posts
- 2
Howto terminate all running subshells?
I have a script that starts a subshell
so the script waits in the loop for the subshell to finish then does processing and starts over. If I kill the script the subshell is not killed. So I can trap the TERM event and do some cleaning but I need to know the subshell process id.Code:#!/bin/sh local SSPID clean_exit() { #here the subshell shall be killed exit 0 } trap clean_exit INT TERM EXIT while true do #open a subshell that waits for events, let's say user input cmd=$(read) #do something with the $cmd ... done
I'm using busybox so ps does not accept any parameters
I cannot source subshell so it can access its parent environment
So how can it done? Thanks
- 11-21-2010 #2
So can you get the subshell to do something with $$, the PID?
- 11-21-2010 #3Just Joined!
- Join Date
- Nov 2010
- Posts
- 2
what should the subshell do with its parent PID?


Reply With Quote
