Getting a Process PID in Bash
Every shell script runs as a process with a unique ID (PID). You need this ID for process management, logging, temporary file naming, and cleanup operations. The $$ variable The special variable $$ expands to the PID of the current shell process: echo $$ This returns a single integer — the PID of your current…
