Java Reference
In-Depth Information
Table 9-2. Interpretation of [arguments] in Combination of the -e or -f Option
-e or -f option
Arguments
Interpretation
Yes
Yes
If -e or -f option is specified, all arguments are passed
to the script as script arguments.
No
Yes
If arguments are specified with no -e or -f option, the
first argument is considered a script file to run. The
rest of the arguments, if any, are passed to the script as
script arguments.
No
No
If arguments and -e or -f option are missing, the shell
works in interactive mode, where the shell executes
the script entered in the standard input interactively.
Execution Modes of the Shell
You can use the jrunscript shell in the following three modes:
One-liner mode
Batch mode
Interactive mode
One-liner Mode
The -e option lets you use the shell in one-liner mode. It executes one line of script. The
following command prints a message on the standard output using the Nashorn engine:
C:\>jrunscript -e "print('Hello Nashorn!');"
Hello Nashorn!
C:\>
In one-liner mode, the entire script must be entered on one line. However, a
one-liner script may contain multiple statements.
Batch Mode
The -f option lets you use the shell in batch mode. It executes a script file. Consider a
script file named jrunscripttest.js as shown in Listing 9-1.
 
 
Search WWH ::




Custom Search