Hi,
I have a script that runs a process at the beginning and I want to sleep/wait until this process is finished and then continue with the rest of the script. I am trying with this, but it is not working:
You call your thread Sleep while i > 0 and then use if [ $process -gt 0 ]; ?
Anyhow, if you run your process in the background using the & metachar, you can wait for it to finish and then continue the script. If you are using some other technique, place the ps | grep in the while test like
Are you doing some meaningful work between the time you start the process and the time you begin to wait for it? Or are you starting more than one process at a time asynchronously (backgrounded)?
If the answer to both questions is "no", then why even bother with & and wait ? Just run the process in the foreground. You won't need to explicitly wait or sleep on it.