Created
November 4, 2016 02:51
-
-
Save babyking/31ce2ca29135e1b660fd88af09ef0dcc to your computer and use it in GitHub Desktop.
ruby $开头的特殊变量
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Ruby]$: 是什么意思? | |
ruby comes with a set of predefined variables | |
$: = default search path (array of paths) | |
其他Ruby特殊变量: | |
$! 最近一次的错误信息 | |
$@ 错误产生的位置 | |
$_ gets最近读的字符串 | |
$. 解释器最近读的行数(line number) | |
$& 最近一次与正则表达式匹配的字符串 | |
$~ 作为子表达式组的最近一次匹配 | |
$n 最近匹配的第n个子表达式(和$~[n]一样) | |
$= 是否区别大小写的标志 | |
$/ 输入记录分隔符 | |
$\ 输出记录分隔符 | |
$0 Ruby脚本的文件名 | |
$* 命令行参数 | |
$$ 解释器进程ID | |
$? 最近一次执行的子进程退出状态 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment