Ruby Global $$ (DollarDollar) - rking/pry-docmore GitHub Wiki
The $$ global is the process number of the Ruby running this script.
Can be used for process control tricks, such as recording in a "pidfile" so other processes can later kill the current one, or accessing "/proc/#$$" on systems (such as Linux) having a mounted procfs.
Traditionally used in shell scripts for a quick way to generate a semi-unique temp filename, but this is better achieved like:
require 'tempfile'
t = Tempfile.new 'hi'
# produces a file like: /tmp/hi20121119-2774-1buu566 (because $$ == 2774)