1RHINO(1)                    General Commands Manual                   RHINO(1)
2
3
4

NAME

6       rhino  - invokes the JavaScript shell for running scripts in batch mode
7       or interactive
8
9

SYNOPSIS

11       rhino [options] script_filename_or_url [script_arguments]
12
13

DESCRIPTION

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

OPTIONS

23       -debug Generate debug information. This will set the optimization level
24              to zero.
25
26       -e script_source
27              Executes script_source as a JavaScript script.
28
29       -encoding characterEncoding
30              Set  the character encoding to apply in case it could not be de‐
31              tected.
32
33       -f script_filename_or_url
34              Reads script_filename_or_url content and execute it as  a  Java‐
35              Script script.
36
37       -fatal-warnings
38              Set warnings as errors.
39
40       -help, -?
41              Display help.
42
43       -modules module
44              Add a module to the path.
45
46       -opt, -O optLevel
47              Optimizes  at level optLevel, which must be an integer between 0
48              and 9.
49
50       -require
51              Use require().
52
53       -sandbox
54              The created require() instances will be sandboxed.
55
56       -sealedlib
57              Use a sealed standard library.
58
59       -strict
60              Set strict mode.
61
62       -version versionNumber
63              Specifies the language version to compile with. It must  be  one
64              of 100, 110, 120, 130, 140, 150, 160, 170, 180 or 200.
65
66       -w     Report warnings.
67
68

PREDEFINED PROPERTIES

70       Scripts  executing  in the shell have access to some additional proper‐
71       ties of the top-level object.
72
73
74       arguments
75              The arguments object is an array containing the strings  of  all
76              the  arguments  given at the command line when the shell was in‐
77              voked.
78
79       help() Executing the help function will print usage and help messages.
80
81       defineClass(className)
82              Define an extension using the Java class named with  the  string
83              argument  className.  Uses ScriptableObject.defineClass() to de‐
84              fine the extension.
85
86       deserialize(filename)
87              Restore from the specified file an object previously written  by
88              a call to serialize.
89
90       load([filename,...])
91              Load  JavaScript source files named by string arguments. If mul‐
92              tiple arguments are given, each file is read in and executed  in
93              turn.
94
95       loadClass(className)
96              Load  and  execute the class named by the string argument class‐
97              Name. The class must be a class that implements the  Script  in‐
98              terface, as will any script compiled by jsc.
99
100       print([expr...])
101              Evaluate  and print expressions. Evaluates each expression, con‐
102              verts the result to a string, and prints it.
103
104       readFile(path[,characterCoding])
105              Read given file and convert its bytes  to  a  string  using  the
106              specified  character  coding  or default character coding if ex‐
107              plicit coding argument is not given.
108
109       readUrl(url[,characterCoding])
110              Open an input connection to the given string url, read  all  its
111              bytes and convert them to a string using the specified character
112              coding or default character coding if explicit  coding  argument
113              is not given.
114
115       runCommand(commandName,[arg,...][options])
116              Execute  the  specified  command with the given argument and op‐
117              tions as a separate process and return the exit  status  of  the
118              process.   For   details,   see  JavaDoc  for  org.mozilla.java‐
119              script.tools.shell.Global#runCommand.
120
121       setTimeout(function[,delay,arg,...])
122              Execute "function" after "delay" milliseconds.  (If  "delay"  is
123              not  set,  then it is set to 0.) Pass any trailing parameters as
124              arguments. Timeouts run after the current function is done  exe‐
125              cuting,  and  in  the interactive shell, only after the shell is
126              exited. Return an ID that may be passed to "clearTimeout".
127
128       clearTimeout(id)
129              Cancel a timeout set using "setTimeout".
130
131       serialize(object,filename)
132              Serialize the given object to the specified file.
133
134       spawn(functionOrScript)
135              Run the given function or script in a different thread.
136
137       sync(function)
138              creates a synchronized function (in the sense of a Java synchro‐
139              nized  method)  from an existing function. The new function syn‐
140              chronizes on the this object of its invocation.
141
142       quit() Quit shell. The shell will also quit in interactive mode  if  an
143              end-of-file character is typed at the prompt.
144
145       version([number])
146              Get  or  set  JavaScript  version number. If no argument is sup‐
147              plied, the current version number is returned. If an argument is
148              supplied,  it  is expected to be one of 100, 110, 120, 130, 150,
149              160, 170, 180 or 200 to indicate JavaScript  version  1.0,  1.1,
150              1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8 or ECMAScript 6 respectively.
151
152       write([expr...])
153              Evaluate  and print expressions like in "print", but without the
154              trailing newline.
155
156

SEE ALSO

158       The         archived         online         documentation         under
159       https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Shell
160https://web.archive.org/web/20210507045220/https://developer.mozilla.org/en-
161       US/docs/Mozilla/Projects/Rhino/Shell⟩
162
163

AUTHOR

165       This  manual  page was created by Wolfgang Baer <WBaer@gmx.de>, see Git
166       history for later modifications.
167
168
169
170                              December  11, 2021                      RHINO(1)
Impressum