Tag:
PID
For any number of reasons you may want to know the parent process ID of the current Bash script. You can find the parent process of the current Bash script or shell by printing the ‘$PPID‘ shell variable. $ echo $PPID20341
In order to control or monitor background child processes from a shell script you will need to know the PID of the child. Bash stores the PID of the last process executed in the “$!” shell variable. If you start a background process in an interactive shell it will output the PID of the child. [...]
In many cases you will need to determine the PID of a current Bash script or shell. Bash stores a specific variable that allows you to view the process ID of the current shell “$$‘. You can echo the $$ to print the current PID. $ echo $$23490
The process environment consists of all the individual environment variables which are passed on to the program by the shell when the program is launched. This environment can be read and changed by the program during its execution, and can affect how a program is linked or how it executes. For all these reasons it [...]