points to process-id of currently running process i.e. shell.
Let's say if you have login into some system using ssh
, and entered into a new shell. Then you can find process-id of that process as,
~$ ps -ef | grep ssh
~$ pgrep ssh
Will show you the process-id of currently running shell process i.e. process-id of your running ssh session (i.e. process).
Use of more $
characters will do nothing, but just repeatedly print the process-ids again and again. For instance:
~$ echo This is $$
This is 1234
~$ echo This is $$$
This is 1234$
~$ This is $$$$
This is 12341234
So, in a nutshell, shell considers use of $$
as process-id of currently running process, and $
as simple character.