jjs has capabilities that
jrunscript doesn't, and
jrunscript has an initialization file. Below are a few simple examples of
nashorn> alert("hello, InfoWorld");
script error: ReferenceError: "alert" is not defined in <STDIN> at line number 1
This doesn't work because
alert() is a browser/DOM function. D'oh! I could have sworn that worked in Rhino, though.
nashorn> print("Hello, InfoWorld");
This does work because
nashorn> var a = 1;
nashorn> var b = "1";
nashorn> print (a+b);
a+b, consider this:
nashorn> print (typeof(a+b));
Nashorn supports the "#" character as a leading line comment marker, so
chmod utility to make it runnable.
You'll find a scripting mode in
jrunscript seems to lack. In scripting mode, expressions inside back-ticks are passed to the outer shell for evaluation:
$ jjs -scripting
jjs> print ('ls');
Creative Cloud Files
Scripting mode also enables an extension for "heredocs," which are basically multiline strings in a format familiar to Perl and Ruby programmers.
By the way, the arrow keys on the Mac keyboard don't work properly for line editing in the
jjs shell. But there is a hack for that: You can
brew install rlwrap and use that as part of your alias for
jjs in your .bashrc or .zshrc file.
You may still be better off sticking with Win7 or Win8.1, given the wide range of ongoing Win10...
Now that we're down to the wire, many upgraders report that the installer hangs. If this happens to...
Angular 3 will have better tooling and will generate less code; Google also is promising a new major...
The Trump team’s plan for the FCC would strip it of authority to champion consumer rights and combat...
Avoid the five resume writing mistakes most commonly seen in the IT Resume Makeover series ...
Thanks to Docker, container adoption has been huge. The benefits to developers have been, too. But the...
Windows 10 tip: Largely unchanged since Windows 7, the Reliability Monitor excels at jogging your...