in reply to Re^3: parent process stuck in read(2) on pipe opened to child process using backtick
in thread parent process stuck in read(2) on pipe opened to child process using backtick

I'm not aware of any way to create a new process group from within the shell script
I tried googling: New Process Group in Shell Script
  • Comment on Re^4: parent process stuck in read(2) on pipe opened to child process using backtick

Replies are listed 'Best First'.
Re^5: parent process stuck in read(2) on pipe opened to child process using backtick
by Eliya (Vicar) on Feb 15, 2012 at 00:40 UTC

    This isn't really what I meant.   Or how would you adapt this in any elegant way so that when put in a.sh, it runs the code in the script itself under a new process group?  (The idea being that you could say my $x=`./a.sh` without creating an extra wrapper script.)

      I am not sure it would work as advertised, but I woudl try something like
      bash -i -c '(HERE GOES THE ORIGINAL CODE OF a.sh) & echo $!'
      Update: The echo would probably mess with the backticks. I should not link to a material I am not so familiar with :-)

        I don't think this would work (for several reasons).  Also, the -c '...' would result in a quoting mess with any real script code.

        I you think differently, please provide a complete modified a.sh, which, when killed, kills its subprocesses, but not the calling process.