令牌"$$"在Ruby中意味着什么?

Tan*_*nin 4 ruby minimagick

我在mini_magick库中的makeTempname()中的image_temp_file.rb中看到了这个变量.

Dig*_*oss 5

$开始一个全局变量的引用.程序通常会定义类似$ name的内容,系统会预定义许多信息和控件引用.

特别是$$,是进程ID.

 
    $name program-defined global variable
    $!  latest error message
    $@  location of error
    $_  string last read by gets
    $.  line number last read by interpreter
    $&  string last matched by regexp
    $~  the last regexp match, as an array of subexpressions
    $n  the nth subexpression in the last match (same as $~[n])
    $=  case-insensitivity flag
    $/  input record separator
    $\  output record separator
    $0  the name of the ruby script file
    $*  the command line arguments
    $$  interpreter's process ID
    $?  exit status of last executed child process