0

I am using SpiderMonkey 1.8.5 on Debian. I am starting a script through the command-line using

js -f <myScript>

I'd like to pass some arguments to my script, but I don't know how to do that. It's supposedto be possible since the documentation tells you about a special object gathring all parameters provided to a script.

I tried the following:

js -f <myScript> <1stArg>

But SpiderMonkey consider both parameters as different scripts to execute and thus sends en error saying the '<1stArg>' file doesn't exist.

What is the correct way to do what I wish?

Bernard Rosset
  • 4,523
  • 6
  • 27
  • 29
  • Which lines in the documentation you refers to talk about "gathering all parameters provided to a script"? – JavaMan Aug 01 '12 at 09:12

1 Answers1

1

Like this:

In script.js

#!/usr/bin/js
print(arguments);

Then from system shell:

$ chmod +x script.js
$ ./script.js
Jacek Krysztofik
  • 1,266
  • 1
  • 13
  • 29