What does "$$" mean in the shell?
What does the output of the command below mean? (result is positive integer)
echo $$
The $$
variable in bash and other shells contains the process id of the shell.
See this Stack overflow question and this one also has more detail about what it is more precisely, and commands similar to it.
As the other (accepted) answer indicated, the $ param represents the current process id (PID) of the current shell.
Echoing this param should work in most shells (not just Bash):
Bash:
$ echo $0
bash
$ echo $$
6780
Bourne:
$ echo $0
sh
$ echo $$
6988
C-Shell:
% echo $shell
/bin/csh
% echo $$
7613
It's important to note too, that commands from within the shell will run under the shell's parent process id (PPID).
$ echo $$
6780
$ ps -ef | grep 6780
aploetz 6780 6770 0 11:15 pts/2 00:00:00 bash
aploetz 8572 6780 0 11:34 pts/2 00:00:00 ps -ef
aploetz 8573 6780 0 11:34 pts/2 00:00:00 grep --color=auto 6780