Monday, October 05, 2009

How to know my own PID in a bash shellscript

I was sure there's a way to know easily what is the PID in a bash shellscript, without doing anything complicated -such a ps wwaux | grep something- and then I've found this quick ref. about less easily guessed commands and codes in Unix shell

By the way, inside a shellscript, the PID of that shellscript is stored in the $$ environment variable, for instance, you may type this on your terminal:
echo "My pid is $$"
and you'll get something like:
My pid is 14467

Labels: ,