Hya,
I am trying to write a sort of simple shell script, which
1) opens one window and send to background (child), then
2) does something interactive on original window (parent), and
3) closes child window then
4) exits.
To do step 3, I need to know Job ID of child process.
I use tcsh.
I thought that $! would work, but the command at step 1 looks like
Code:
find $1 -name $2 -exec doCommand \; &
so that $! looks like to hold process ID of "find" command, (instead of doCommand)
So, at this moment I have
Code:
kill `ps -e | grep $! | grep doCommand | tr -s ' ' | cut -f 2 -d ' '`
at step 3.
This code does not look good and difficult to read....
Is there any better way to get process ID of grand child??
Happy Penguins!