Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

2. Language Basics > 2.1. Command-Line Options

Command-Line Options

Like most scripting language interpreters, Ruby is generally run from the command line. The interpreter can be invoked with the following options, which control the environment and behavior of the interpreter itself:

ruby [ options ] [—] [ programfile ] [ argument... ]
-a

Used with -n or -p to split each line. Split output is stored in $F.

-c

Checks syntax only, without executing program.

-C dir

Changes directory before executing (equivalent to -X).

-d

Enables debug mode (equivalent to -debug). Sets $DEBUG to true.

-e prog

Specifies prog as the program from the command line. Specify multiple -e options for multiline programs.

-F pat

Specifies pat as the default separator pattern ($;) used by split.

-h

Displays an overview of command-line options (equivalent to -help).


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint