dollar dollar
The special parameter $$, which holds the process ID of the current shell.
In more detail
Scripts use it to signal themselves, as in kill -TERM $$, or to ask ps about the running shell. Inside a subshell it still reports the parent shell, which surprises people.
Example
ps -p $$ -o comm=Related terms
- process ID — The number the kernel gives each running process so it can be told apart from all the others.
- ps — The command that lists running processes with details such as process ID, CPU use and command name.
- kill — The command that sends a signal to a process or job, SIGTERM by default, despite its name.
Taught in
- Which Shell Am I In, And Getting Bash Five — Bash Scripting & Command Line Automation
- trap, Cleanup And Temporary Files — Bash Scripting & Command Line Automation
- Processes, Jobs And Signals — Bash Scripting & Command Line Automation