Wait Process in Shell Scripting.

Hello,

I have a script that needs to wait till the previous process is done within the same script.But my script doesnt wait till that it is done.Can anyone suggest how I can stop my process till the previous task is done.

I tried 'wait' but I dont have a static process id so is there anyother better way?

pmcmd startworkflow test
wait
echo "Workflow complete"

pmcmd is a command to execute Informatica jobs in Unix.My process needs to wait till the workflow is complete.

Thanks,
Sud.

Hi,
Have you tried sleep?

@thegant, Not sure if sleep would be useful as you don't know for how many seconds the script has to sleep.

@Sud, I suppose you can try:

 
pmcmd startworkflow test
if [[ $? -eq 0 ]]; then
  echo "Workflow complete"
fi
 

If the above doesn't suffice, then perhaps you can find the process id of the command and then grep for the process id's completion and then run the next command.

HTH, :cool:

Regards,

Praveen