Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a command that's processing some data in one shell window (let's say it has pid 200). Unfortunately I forgot to add the & to run it in the background.

I need to run some analysis script after pid 200 is finished. I thought I could just open up another shell window and do

wait 200; ./

But it complains to me

"-bash: wait: pid 200 is not a child of this shell"

With that in mind, is there a way I can execute my analysis script automatically after this process terminates?

share|improve this question

Can you use ^z and then do the following?

wait 200; ./
fg %1

This will wait till pid 200 is finished, then run your analysis, and then will put itself in foreground.

share|improve this answer

You can't "wait" for non-child processes, and you have to manually check it periodically. See for example this stack overflow answer.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .