1RHINO(1) General Commands Manual RHINO(1)
2
3
4
6 rhino - invokes the JavaScript shell for running scripts in batch mode
7 or interactive
8
9
11 rhino [options] script_filename_or_url [script_arguments]
12
13
15 This manual page documents briefly the rhino command.
16
17 rhino is a start script for the rhino JavaScript shell which provides a
18 simple way to run scripts in batch mode or an interactive environment
19 for exploratory programming.
20
21
23 -?, -help
24 Displays help messages.
25
26 -w Enable warnings.
27
28 -e script_source
29 Executes script_source as a JavaScript script.
30
31 -f script_filename_or_url
32 Reads script_filename_or_url content and execute it as a
33 JavaScript script.
34
35 -opt, -O optLevel
36 Optimizes at level optLevel, which must be an integer between 0
37 and 9.
38
39 -version versionNumber
40 Specifies the language version to compile with. The string ver‐
41 sionNumber must be one of 100, 110, 120, 130, 140, 150, 160, 170
42 or 180. See JavaScript Language Versions for more information on
43 language versions.
44
45 -modules uri
46 Add a single path or URL element to the CommonJS module search
47 path. (implies -require)
48
49 -require
50 Enable CommonJS module support.
51
52 -sandbox
53 Enable CommonJS sandbox mode. (implies -require)
54
55 -debug Generate debug code.
56
57 -strict
58 Enable strict mode warnings.
59
60 -fatal-warnings
61 Treat warnings as errors.
62
63 -encoding charset
64 Use specified character encoding as default when reading
65 scripts.
66
67
69 Scripts executing in the shell have access to some additional proper‐
70 ties of the top-level object.
71
72
73 arguments
74 The arguments object is an array containing the strings of all
75 the arguments given at the command line when the shell was
76 invoked.
77
78 environment
79 Returns the current environment object.
80
81 history
82 Displays the shell command history.
83
84 help() Executing the help function will print usage and help messages.
85
86 defineClass(className)
87 Define an extension using the Java class named with the string
88 argument className. Uses ScriptableObject.defineClass() to
89 define the extension.
90
91 deserialize(filename)
92 Restore from the specified file an object previously written by
93 a call to serialize.
94
95 gc() Runs the garbage collector.
96
97 load([filename,...])
98 Load JavaScript source files named by string arguments. If mul‐
99 tiple arguments are given, each file is read in and executed in
100 turn.
101
102 loadClass(className)
103 Load and execute the class named by the string argument class‐
104 Name. The class must be a class that implements the Script
105 interface, as will any script compiled by jsc.
106
107 print([expr...])
108 Evaluate and print expressions. Evaluates each expression, con‐
109 verts the result to a string, and prints it.
110
111 readFile(path[,characterCoding])
112 Read given file and convert its bytes to a string using the
113 specified character coding or default character coding if
114 explicit coding argument is not given.
115
116 readUrl(url[,characterCoding])
117 Open an input connection to the given string url, read all its
118 bytes and convert them to a string using the specified character
119 coding or default character coding if explicit coding argument
120 is not given.
121
122 runCommand(commandName,[arg,...][options])
123 Execute the specified command with the given argument and
124 options as a separate process and return the exit status of the
125 process. For details, see JavaDoc for
126 org.mozilla.javascript.tools.shell.Global#runCommand.
127
128 seal(object)
129 Seal the specified object so any attempt to add, delete or mod‐
130 ify its properties would throw an exception.
131
132 serialize(object,filename)
133 Serialize the given object to the specified file.
134
135 spawn(functionOrScript)
136 Run the given function or script in a different thread.
137
138 sync(function)
139 creates a synchronized function (in the sense of a Java synchro‐
140 nized method) from an existing function. The new function syn‐
141 chronizes on the this object of its invocation.
142
143 quit() Quit shell. The shell will also quit in interactive mode if an
144 end-of-file character is typed at the prompt.
145
146 version([number])
147 Get or set JavaScript version number. If no argument is sup‐
148 plied, the current version number is returned. If an argument is
149 supplied, it is expected to be one of 100, 110, 120, 130, 140,
150 150, 160, 170 or 180 to indicate JavaScript version 1.0, 1.1,
151 1.2, 1.3, 1.4, 1.5, 1.6, 1.7 or 1.8 respectively.
152
153
155 The online documentation under http://www.mozilla.org/rhino/shell.html
156 ⟨http://www.mozilla.org/rhino/shell.html⟩
157
158
160 This manual page was written by Wolfgang Baer <WBaer@gmx.de>, with mod‐
161 ifications by Elliott Baron <ebaron@redhat.com>.
162
163
164
165 September 09, 2013 RHINO(1)