Mega Code Archive

 
Categories / Ruby / Language Basics
 

Running the Ruby Interpreter

Usage: ruby [switches] [--] [program filename] [arguments] Switches (or command-line options): -0[ octal]      Specify a record separator (\0 if no argument). -a              Autosplit mode with -n or -p (splits $_ into $F). -c              Check syntax only. -C directory    cd to directory before executing your script or program. -d              Set debugging flags (set predefined variable $DEBUG to true). -e ' command'   Execute one line of script. Several -es allowed. Omit [program filename]. -F pattern      split( ) pattern for autosplit (-a). -i[ extension]  Edit ARGV files in place (make backup if extension supplied). -I directory    Specify $LOAD_PATH (predefined variable) directory; may be used more than once. -K kcode        Specify the character set. See Table 16. -l              Enable line-ending processing. -n              Assume 'while gets( ); ... end' loop around your script. -p              Assume loop like -n but print line also like sed. -r library      Require the library before executing your script. -s              Enable some switch parsing for switches after script name. -S              Look for the script using PATH environment variable. -T[ level]      Turn on tainting checks. -v              Print version number, then turn on verbose mode (compare --version). -w              Turn warnings on for your script or program. -W[ level]      Set warning level: 0=silence, 1=medium, and 2=verbose (default). -x[ directory]  Strip off text before #! shebang line, and optionally cd to directory. --copyright     Print the copyright. --version       Print the version (compare -v).