6.7. Ruby command line options

发布时间 :2023-10-25 23:00:07 UTC      

Ruby is typically run from the command line as follows:

$ ruby [ options ] [.] [ programfile ] [ arguments ... ]

The interpreter can be called through the following options to control the environment and behavior of the interpreter.

Option

Description

-a

When used with-n or-p, you can turn on automatic split mode (auto split mode). Check the-n and-p options.

-c

Only check the syntax, do not execute the program.

-C dir

Change the directory before execution (equivalent to-X).

-d

Enable debug mode (equivalent to-debug).

-F pat

Specify pat as the default detach mode ($;).

-e prog

Specifies that prog is executed on the command line as a program. You can specify multiple-e options to execute multiple programs.

-h

Displays an overview of command line options.

-i [ ext]

Rewrite the contents of the file as program output. The original file is saved with the extension ext. If no ext is specified, the original file is deleted.

-I dir

Add dir as the directory to load the library.

-K [ kcode]

Specifies the multibyte character set encoding. E or E corresponds to EUC (extended Unix code), s or S corresponds to SJIS (Shift-JIS), u or U corresponds to UTF-8,a, A, n or N corresponds to ASCII.

-l

Enable automatic line end processing. Remove a newline character from the input line and append a newline character to the output line.

-n

Place the code in an input loop (as in while gets;. Same in end).

-0[ octal]

Set the default record delimiter ($/) to octal. If octal is not specified, it defaults to0.

-p

Place the code in an input loop. Output variables after each iteration $_ The value of.

-r lib

Use require to load lib as a pre-execution library.

-s

Interpret the matching pattern between the program name and the file name parameter-any parameter of xxx as a switch and define the corresponding variable.

-T [level]

Set the security level and perform an impurity test (if level is not specified, the default is 1).

-v

Displays the version and enables redundancy mode.

-w

Enable redundancy mode. If no program file is specified, it is read from STDIN.

-x [dir]

Delete the text before the #! ruby line. If dir is specified, change the directory to dir.

-X dir

Change the directory before execution (equivalent to-C).

-y

Enable parser debug mode.

--copyright

Displays the copyright notice.

--debug

Enable debug mode (equivalent to-d).

--help

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

--version

Displays the version.

--verbose

Enable redundancy mode (equivalent to-v). Set $VERBOSE to true.

--yydebug

Enable parser debug mode (equivalent to-y).

Single-character command line options can be combined. The following two lines express the same meaning:

$ ruby -ne 'print if /Ruby/' /usr/share/bin
$ ruby -n -e 'print if /Ruby/' /usr/share/bin

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.