Sunday, 15 April 2012

multithreading - Process not giving up child pid -



multithreading - Process not giving up child pid -

i want kid , parent pid. this:

function x { echo $1 $$; }

now when next expect function x have parent , kid pids:

x $$ &

however, x has parent pid. how can function run separate process?

i believe you're looking $bashpid:

#! /bin/bash function x { echo $$ $bashpid;} x & child=$!; wait ; echo $child

output:

bash test.sh 1191 1195 1195

multithreading bash

No comments:

Post a Comment