Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Howto terminate all running subshells?

    I have a script that starts a subshell

    local SSPID
    clean_exit() {
      #here the subshell shall be killed
      exit 0
    trap clean_exit INT TERM EXIT
    while true
      #open a subshell that waits for events, let's say user input
      #do something with the $cmd
    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.

    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

  2. #2
    Just Joined! barriehie's Avatar
    Join Date
    Apr 2008
    The Desert!
    So can you get the subshell to do something with $$, the PID?

  3. #3
    what should the subshell do with its parent PID?

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts