1jrunscript(1)                   Scripting Tools                  jrunscript(1)
2
3
4

NAME

6       jrunscript - Runs a command-line script shell that supports interactive
7       and batch modes. This command is experimental and unsupported.
8

SYNOPSIS

10       jrunscript [options] [arguments]
11
12
13       options
14              The command-line options. See Options.
15
16       arguments
17              Arguments, when used, follow immediately after options or the
18              command name. See Arguments.
19

DESCRIPTION

21       The jrunscript command is a language-independent command-line script
22       shell. The jrunscript command supports both an interactive (read-eval-
23       print) mode and a batch (-f option) mode of script execution. By
24       default, JavaScript is the language used, but the -l option can be used
25       to specify a different language. By using Java to scripting language
26       communication, the jrunscript command supports an exploratory
27       programming style.
28

OPTIONS

30       -classpath path
31              Indicate where any class files are that the script needs to
32              access.
33
34       -cp path
35              Same as -classpathpath.
36
37       -Dname=value
38              Sets a Java system property.
39
40       -Jflag
41              Passes flag directly to the Java Virtual Machine where the
42              jrunscript command is running.
43
44       -I language
45              Uses the specified scripting language. By default, JavaScript is
46              used. To use other scripting languages, you must specify the
47              corresponding script engine's JAR file with the -cp or
48              -classpath option.
49
50       -e script
51              Evaluates the specified script. This option can be used to run
52              one-line scripts that are specified completely on the command
53              line.
54
55       -encoding encoding
56              Specifies the character encoding used to read script files.
57
58       -f script-file
59              Evaluates the specified script file (batch mode).
60
61       -f -
62              Reads and evaluates a script from standard input (interactive
63              mode).
64
65       -help
66              Displays a help message and exits.
67
68       -?
69              Displays a help message and exits.
70
71       -q
72              Lists all script engines available and exits.
73

ARGUMENTS

75       If arguments are present and if no -e or -f option is used, then the
76       first argument is the script file and the rest of the arguments, if
77       any, are passed to the script. If arguments and -e or the -f option are
78       used, then all arguments are passed to the script. If arguments, -e and
79       -f are missing, then interactive mode is used. Script arguments are
80       available to a script in an engine variable named arguments of type
81       String array.
82

EXAMPLES

84   EXECUTE INLINE SCRIPTS
85       jrunscript -e "print('hello world')"
86       jrunscript -e "cat('http://www.example.com')"
87
88
89   USE SPECIFIED LANGUAGE AND EVALUATE THE SCRIPT FILE
90       jrunscript -l js -f test.js
91
92
93   INTERACTIVE MODE
94       jrunscript
95       js> print('Hello World\n');
96       Hello World
97       js> 34 + 55
98       89.0
99       js> t = new java.lang.Thread(function() { print('Hello World\n'); })
100       Thread[Thread-0,5,main]
101       js> t.start()
102       js> Hello World
103       js>
104
105
106   RUN SCRIPT FILE WITH SCRIPT ARGUMENTS
107       The test.js file is the script file. The arg1, arg2 and arg3 arguments
108       are passed to the script. The script can access these arguments with an
109       arguments array.
110
111       jrunscript test.js arg1 arg2 arg3
112
113

SEE ALSO

115       If JavaScript is used, then before it evaluates a user defined script,
116       the jrunscript command initializes certain built-in functions and
117       objects. These JavaScript built-ins are documented in JsDoc-Toolkit at
118       http://code.google.com/p/jsdoc-toolkit/
119
120
121
122JDK 8                          21 November 2013                  jrunscript(1)
Impressum