2
|
1 |
.'" t
|
|
2 |
."
|
|
3 |
." Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
4 |
." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
5 |
."
|
|
6 |
." This code is free software; you can redistribute it and/or modify it
|
|
7 |
." under the terms of the GNU General Public License version 2 only, as
|
|
8 |
." published by the Free Software Foundation.
|
|
9 |
."
|
|
10 |
." This code is distributed in the hope that it will be useful, but WITHOUT
|
|
11 |
." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
12 |
." FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
13 |
." version 2 for more details (a copy is included in the LICENSE file that
|
|
14 |
." accompanied this code).
|
|
15 |
."
|
|
16 |
." You should have received a copy of the GNU General Public License version
|
|
17 |
." 2 along with this work; if not, write to the Free Software Foundation,
|
|
18 |
." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
19 |
."
|
|
20 |
." Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
21 |
." CA 95054 USA or visit www.sun.com if you need additional information or
|
|
22 |
." have any questions.
|
|
23 |
."
|
|
24 |
." `
|
|
25 |
.TH jrunscript 1 "06 Aug 2006"
|
|
26 |
." Generated by html2man
|
|
27 |
|
|
28 |
.LP
|
|
29 |
.SH NAME
|
|
30 |
jrunscript \- command line script shell
|
|
31 |
.LP
|
|
32 |
.SH "SYNOPSIS"
|
|
33 |
.LP
|
|
34 |
|
|
35 |
.LP
|
|
36 |
.nf
|
|
37 |
\f3
|
|
38 |
.fl
|
|
39 |
\fP\f3jrunscript\fP [ \f2options\fP ] [ arguments... ]
|
|
40 |
.fl
|
|
41 |
.fi
|
|
42 |
|
|
43 |
.LP
|
|
44 |
.SH "PARAMETERS"
|
|
45 |
.LP
|
|
46 |
|
|
47 |
.LP
|
|
48 |
.TP 3
|
|
49 |
options
|
|
50 |
Options, if used, should follow immediately after the command name.
|
|
51 |
.TP 3
|
|
52 |
arguments
|
|
53 |
Arguments, if used, should follow immediately after options or command name.
|
|
54 |
.LP
|
|
55 |
.SH "DESCRIPTION"
|
|
56 |
.LP
|
|
57 |
|
|
58 |
.LP
|
|
59 |
.LP
|
|
60 |
\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.
|
|
61 |
.LP
|
|
62 |
.LP
|
|
63 |
\f3NOTE:\fP This tool is \f3experimental\fP and may \f3not\fP be available in future versions of the JDK.
|
|
64 |
.LP
|
|
65 |
.SH "OPTIONS"
|
|
66 |
.LP
|
|
67 |
|
|
68 |
.LP
|
|
69 |
.TP 3
|
|
70 |
\-classpath path
|
|
71 |
Specify where to find the user's .class files that are accessed by the script.
|
|
72 |
.TP 3
|
|
73 |
\-cp path
|
|
74 |
This is a synonym for \-classpath \f2path\fP
|
|
75 |
.TP 3
|
|
76 |
\-Dname=value
|
|
77 |
Set a Java system property.
|
|
78 |
.TP 3
|
|
79 |
\-J<flag>
|
|
80 |
Pass <flag> directly to the Java virtual machine on which jrunscript is run.
|
|
81 |
.TP 3
|
|
82 |
\-l language
|
|
83 |
Use 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
|
|
86 |
Evaluate 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
|
|
89 |
Specify the character encoding used while reading script files.
|
|
90 |
.TP 3
|
|
91 |
\-f script\-file
|
|
92 |
Evaluate the given script file (batch mode).
|
|
93 |
.TP 3
|
|
94 |
\-f \-
|
|
95 |
Read and evaluate a script from standard input (interactive mode).
|
|
96 |
.TP 3
|
|
97 |
\-help\
|
|
98 |
Output help message and exit.
|
|
99 |
.TP 3
|
|
100 |
\-?\
|
|
101 |
Output help message and exit.
|
|
102 |
.TP 3
|
|
103 |
\-q\
|
|
104 |
List all script engines available and exit.
|
|
105 |
.LP
|
|
106 |
.SH "ARGUMENTS"
|
|
107 |
.LP
|
|
108 |
.LP
|
|
109 |
If [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.
|
|
110 |
.LP
|
|
111 |
.SH "EXAMPLES"
|
|
112 |
.LP
|
|
113 |
\f3Executing inline scripts\fP
|
|
114 |
.LP
|
|
115 |
.RS 3
|
|
116 |
|
|
117 |
.LP
|
|
118 |
.nf
|
|
119 |
\f3
|
|
120 |
.fl
|
|
121 |
jrunscript \-e "print('hello world')"
|
|
122 |
.fl
|
|
123 |
jrunscript \-e "cat('http://java.sun.com')"
|
|
124 |
.fl
|
|
125 |
\fP
|
|
126 |
.fi
|
|
127 |
.RE
|
|
128 |
|
|
129 |
.LP
|
|
130 |
\f3Use specified language and evaluate given script file\fP
|
|
131 |
.LP
|
|
132 |
.RS 3
|
|
133 |
|
|
134 |
.LP
|
|
135 |
.nf
|
|
136 |
\f3
|
|
137 |
.fl
|
|
138 |
jrunscript \-l js \-f test.js
|
|
139 |
.fl
|
|
140 |
\fP
|
|
141 |
.fi
|
|
142 |
.RE
|
|
143 |
|
|
144 |
.LP
|
|
145 |
\f3Interactive mode\fP
|
|
146 |
.LP
|
|
147 |
.RS 3
|
|
148 |
|
|
149 |
.LP
|
|
150 |
.nf
|
|
151 |
\f3
|
|
152 |
.fl
|
|
153 |
jrunscript
|
|
154 |
.fl
|
|
155 |
js>print('hello world');
|
|
156 |
.fl
|
|
157 |
hello world
|
|
158 |
.fl
|
|
159 |
js>34 + 55
|
|
160 |
.fl
|
|
161 |
89
|
|
162 |
.fl
|
|
163 |
js> thread(function() { print('hello world'); }
|
|
164 |
.fl
|
|
165 |
hello world
|
|
166 |
.fl
|
|
167 |
js>
|
|
168 |
.fl
|
|
169 |
\fP
|
|
170 |
.fi
|
|
171 |
.RE
|
|
172 |
|
|
173 |
.LP
|
|
174 |
\f3Run script file with script arguments\fP
|
|
175 |
.LP
|
|
176 |
.RS 3
|
|
177 |
|
|
178 |
.LP
|
|
179 |
.nf
|
|
180 |
\f3
|
|
181 |
.fl
|
|
182 |
jrunscript test.js arg1 arg2 arg3
|
|
183 |
.fl
|
|
184 |
\fP
|
|
185 |
.fi
|
|
186 |
.RE
|
|
187 |
|
|
188 |
.LP
|
|
189 |
test.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.
|
|
190 |
.SH "SEE ALSO"
|
|
191 |
.LP
|
|
192 |
.LP
|
|
193 |
If 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.
|
|
194 |
.LP
|
|
195 |
|
|
196 |
.LP
|
|
197 |
|