I personnally find $! much more useful than $$. This allows me to record automatically the pid of a process that I start in a script, so that later I can check the status or kill that process, referring to its pid.
As in perl the $! has another meaning, (this variable is basically the last...
I am trying to develop a simple way to get the pid of a process once it is started. If you start a process in background with the "&", you then get its pid in stdout. But if I run this in a script, let's say a script called "test":
#!/bin/bash
sleep 60 & > test.log 2>&1...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.