Created
April 4, 2013 22:38
-
-
Save lgmkr/5314988 to your computer and use it in GitHub Desktop.
ruby global variables
This file contains hidden or 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
$: contains an array of paths that your script will search through when using require | |
>>$: | |
#=> [".", "/Users/path/.ruby", "/test/path"] | |
$0 script name | |
$* shorter for ARGV | |
$? returns the exit status of the last child process to finish | |
>>`pwd` | |
#=> '/path/to/' | |
>> $? | |
=> #<Process::Status: pid=17867,exited(0)> | |
>> `fake command` # This will fail | |
(irb):7: command not found: fake command | |
=> "" | |
>> $? | |
=> #<Process::Status: pid=17871,exited(127)> | |
$$ returns the process number of the program currently being ran. | |
(tto be con) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment