Why -- when supplying jjs script arguments?

Jim Laskey (Oracle) james.laskey at oracle.com
Sat Oct 12 12:26:03 PDT 2013


In general all arguments prior to -- are for the jjs command (see -help) and all the arguments on the script command line are just a continuation of the shebang line.  At one point it was possible to #!/usr/bin/jjs -- to get all the script command line arguments as arguments, but this doesn't seem to work any more, will check with the launcher team about this.



On 2013-10-12, at 12:28 AM, Cay Horstmann <cay at horstmann.com> wrote:

> Hi, I am writing a chapter on Nashorn for "Java 8 for the Impatient", which will eventually find its way into one of the Core Java tomes.
> 
> I am a bit baffled why one needs to supply -- when calling a script with arguments. I mean, when I put a
> 
> #!/usr/bin/jjs
> 
> in a script, why can't I just run it as
> 
> myScript arg1 arg2 arg3
> 
> instead of
> 
> myScript -- arg1 arg2 arg3
> 
> I know I can solve this with a second script, but it seems a hassle. And is this a new thing? The article http://benjiweber.co.uk/blog/2013/01/27/javascript-shell-scripting-with-nashorn/ doesn't mention it.
> 
> Thanks,
> 
> Cay
> 
> -- 
> 
> Cay S. Horstmann | http://horstmann.com | mailto:cay at horstmann.com



More information about the nashorn-dev mailing list