Ruby Command-Line Options
Following is a complete list of Ruby’s command-line options roughly organized by functionality.
Options That Determine What Ruby Runs
- -0[octal]
-
The 0 flag (the digit zero) specifies the record separator character (\0, if no digit follows). -00 indicates paragraph mode: records are separated by two successive default record separator characters. 0777 reads the entire file at once (because it’s an illegal character). Sets $/.
- -a
-
Autosplit mode when used with -n or -p; equivalent to executing $F = $_.split at the top of each loop iteration.
- -c
-
Checks syntax only; does not execute the program.
- --copyright
-
Prints the copyright notice and exits.
- -e ’command’
-
Executes command as one line of Ruby source. Several -es are allowed, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access