I am downloading some software; I can see the
pid of the download process with
top. Let's say it's
How can I make it so that my computer shuts down after process
Here you go. tested and working.
This one-liner loop checks ps output for the process ID 1001, and sleeps for 2 seconds then checks again until it doesn't find it (the process has exited), at which point the loop ends and it moves on to the next command which is a shutdown.
If you want to make sure that process 1001 is the process you think it is, you can add grep to test, for instance if the process should be iTunes, you could do:
Run the following commands: