Ruby - Environment Variables
Ruby interpreter uses the following environment variables to control its behavior. The ENV object contains a list of all the current environment variables set.
Sr.No. | Variable & Description |
---|---|
1 |
DLN_LIBRARY_PATH Search path for dynamically loaded modules. |
2 |
HOME Directory moved to when no argument is passed to Dir::chdir. Also used by File::expand_path to expand "~". |
3 |
LOGDIR Directory moved to when no arguments are passed to Dir::chdir and environment variable HOME isn't set. |
4 |
PATH Search path for executing subprocesses and searching for Ruby programs with the -S option. Separate each path with a colon (semicolon in DOS and Windows). |
5 |
RUBYLIB Search path for libraries. Separate each path with a colon (semicolon in DOS and Windows). |
6 |
RUBYLIB_PREFIX Used to modify the RUBYLIB search path by replacing prefix of library path1 with path2 using the format path1;path2 or path1path2. |
7 |
RUBYOPT Command-line options passed to Ruby interpreter. Ignored in taint mode (Where $SAFE is greater than 0). |
8 |
RUBYPATH With -S option, search path for Ruby programs. Takes precedence over PATH. Ignored in taint mode (where $SAFE is greater than 0). |
9 |
RUBYSHELL Specifies shell for spawned processes. If not set, SHELL or COMSPEC are checked. |
For Unix, use env command to see a list of all the environment variables.
HOSTNAME = ip-72-167-112-17.ip.secureserver.net RUBYPATH = /usr/bin SHELL = /bin/bash TERM = xterm HISTSIZE = 1000 SSH_CLIENT = 122.169.131.179 1742 22 SSH_TTY = /dev/pts/1 USER = rrtutors JRE_HOME = /usr/java/jdk/jre J2RE_HOME = /usr/java/jdk/jre PATH = /usr/local/bin:/bin:/usr/bin:/home/guest/bin MAIL = /var/spool/mail/guest PWD = /home/rrtutorsIN PUTRC = /etc/inputrc JAVA_HOME = /usr/java/jdk LANG = C HOME = /root SHLVL = 2 JDK_HOME = /usr/java/jdk LOGDIR = /usr/log/ruby LOGNAME = rrtutors SSH_CONNECTION = 122.192.131.179 1742 72.167.112.17 22 LESSOPEN = |/usr/bin/lesspipe.sh %s RUBYLIB = /usr/lib/ruby G_BROKEN_FILENAMES = 1 _ = /bin/env |
Ruby program to add two integer numbers
how to create an array with Array.[](*args) in Ruby ?
What are the various Ruby runtimes, and how are they different?
Ruby program to check whether the given number is prime or not
Ruby program to reverse a string
Ruby program to check whether the given number is palindrome
Ruby program to print Fibonacci series
How to Replace array elements in Ruby?
Ruby program to print an array
Ruby program to check whether the given number is Armstrong
Program to Print Triangle of Numbers in Ruby
How to add/remove elements to Array in Ruby?
How to shuffle an array in Ruby?
Creating Array with Array.new(size, obj) in Ruby
Ruby program to generate random numbers
Ruby program to Calculate the factorial of given number
What are #method_missing and #send? Why are they useful?
How to Sort Array in Ruby?
How to get index of array element in Ruby
How to Get Input with Gets in Ruby
How to create two dimensional array in ruby?