blob: 2fdbb9db5ddfd4378ea0011a916b74d0e91e4b04 [file] [log] [blame]
bpatel87d64cc2010-07-14 15:42:06 -07001." Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
duke6e45e102007-12-01 00:00:00 +00002." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3."
4." This code is free software; you can redistribute it and/or modify it
5." under the terms of the GNU General Public License version 2 only, as
6." published by the Free Software Foundation.
7."
8." This code is distributed in the hope that it will be useful, but WITHOUT
9." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10." FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11." version 2 for more details (a copy is included in the LICENSE file that
12." accompanied this code).
13."
14." You should have received a copy of the GNU General Public License version
15." 2 along with this work; if not, write to the Free Software Foundation,
16." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17."
ohair2283b9d2010-05-25 15:58:33 -070018." Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19." or visit www.oracle.com if you need additional information or have any
20." questions.
tbell16c34dd2009-05-04 18:28:26 -070021."
bpatel87d64cc2010-07-14 15:42:06 -070022.TH jrunscript 1 "02 Jun 2010"
duke6e45e102007-12-01 00:00:00 +000023
24.LP
tbell16c34dd2009-05-04 18:28:26 -070025.SH "Name"
duke6e45e102007-12-01 00:00:00 +000026jrunscript \- command line script shell
27.LP
28.SH "SYNOPSIS"
29.LP
30
31.LP
32.nf
33\f3
34.fl
35\fP\f3jrunscript\fP [ \f2options\fP ] [ arguments... ]
36.fl
37.fi
38
39.LP
40.SH "PARAMETERS"
41.LP
42
43.LP
tbell16c34dd2009-05-04 18:28:26 -070044.RS 3
duke6e45e102007-12-01 00:00:00 +000045.TP 3
46options
47Options, if used, should follow immediately after the command name.
48.TP 3
49arguments
50Arguments, if used, should follow immediately after options or command name.
tbell16c34dd2009-05-04 18:28:26 -070051.RE
52
duke6e45e102007-12-01 00:00:00 +000053.LP
54.SH "DESCRIPTION"
55.LP
56
57.LP
58.LP
59\f3jrunscript\fP is a command line script shell. jrunscript supports both an interactive (read\-eval\-print) mode and a batch (\-f option) mode of script execution. This is a scripting language independent shell. By default, JavaScript is the language used, but the \-l option can be used to specify a different language. Through Java to scripting language communication, jrunscript supports "exploratory programming" style.
60.LP
61.LP
62\f3NOTE:\fP This tool is \f3experimental\fP and may \f3not\fP be available in future versions of the JDK.
63.LP
64.SH "OPTIONS"
65.LP
66
67.LP
tbell16c34dd2009-05-04 18:28:26 -070068.RS 3
duke6e45e102007-12-01 00:00:00 +000069.TP 3
70\-classpath path
71Specify where to find the user's .class files that are accessed by the script.
72.TP 3
73\-cp path
74This is a synonym for \-classpath \f2path\fP
75.TP 3
76\-Dname=value
77Set a Java system property.
78.TP 3
79\-J<flag>
80Pass <flag> directly to the Java virtual machine on which jrunscript is run.
81.TP 3
82\-l language
83Use the specified scripting language. By default, JavaScript is used. Note that to use other scripting languages, you also need to specify the corresponding script engine's jar file using \-cp or \-classpath option.
84.TP 3
85\-e script
86Evaluate the given script. This option can be used to run "one liner" scripts specified completely on the command line.
87.TP 3
88\-encoding encoding
89Specify the character encoding used while reading script files.
90.TP 3
91\-f script\-file
92Evaluate the given script file (batch mode).
93.TP 3
94\-f \-
95Read and evaluate a script from standard input (interactive mode).
96.TP 3
97\-help\
98Output help message and exit.
99.TP 3
100\-?\
101Output help message and exit.
102.TP 3
103\-q\
104List all script engines available and exit.
tbell16c34dd2009-05-04 18:28:26 -0700105.RE
106
duke6e45e102007-12-01 00:00:00 +0000107.LP
108.SH "ARGUMENTS"
109.LP
110.LP
111If [arguments...] are present and if no \f3\-e\fP or \f3\-f\fP option is used, then the first argument is the script file and the rest of the arguments, if any, are passed as script arguments. If [arguments..] and \f3\-e\fP or \f3\-f\fP option are used, then all [arguments..] are passed as script arguments. If [arguments..], \f3\-e\fP and \f3\-f\fP are missing, interactive mode is used. Script arguments are available to a script in an engine variable named "arguments" of type String array.
112.LP
113.SH "EXAMPLES"
114.LP
115\f3Executing inline scripts\fP
116.LP
117.RS 3
118
119.LP
120.nf
121\f3
122.fl
123jrunscript \-e "print('hello world')"
124.fl
125jrunscript \-e "cat('http://java.sun.com')"
126.fl
127\fP
128.fi
129.RE
130
131.LP
132\f3Use specified language and evaluate given script file\fP
133.LP
134.RS 3
135
136.LP
137.nf
138\f3
139.fl
140jrunscript \-l js \-f test.js
141.fl
142\fP
143.fi
144.RE
145
146.LP
147\f3Interactive mode\fP
148.LP
149.RS 3
150
151.LP
152.nf
153\f3
154.fl
155jrunscript
156.fl
157js>print('hello world');
158.fl
159hello world
160.fl
161js>34 + 55
162.fl
16389
164.fl
165js> thread(function() { print('hello world'); }
166.fl
167hello world
168.fl
169js>
170.fl
171\fP
172.fi
173.RE
174
175.LP
176\f3Run script file with script arguments\fP
177.LP
178.RS 3
179
180.LP
181.nf
182\f3
183.fl
184jrunscript test.js arg1 arg2 arg3
185.fl
186\fP
187.fi
188.RE
189
190.LP
191test.js is script file to execute and arg1, arg2 and arg3 are passed to script as script arguments. Script can access these using "arguments" array.
192.SH "SEE ALSO"
193.LP
194.LP
195If JavaScript is used, then before evaluating any user defined script, jrunscript initializes certain built\-in functions and objects. These JavaScript built\-ins are documented in jsdocs.
196.LP
duke6e45e102007-12-01 00:00:00 +0000197