What is $$ in Bash?

What is $$ in Bash?

Listen to this article
AI voice: Sadaltager • Click play to generate
0:00
--:--

$$ is an internal variable that stores the process ID of the script itself or the current bash instance.

Here is an example use case:

echo $$

This produces the following output:

darryl@Darryl-PC$ echo $$
8
I'm Feeling Lucky
Darryl Dias

Written by Darryl Dias

The AI guy and founder of Caprycon, building AI-powered tools, exploring emerging technologies, and sharing insights from the world of artificial intelligence