Reputation: 6493
In terms of quick dynamically typed languages, I'm really starting to like Javascript, as I use it a lot for web projects, especially because it uses the same syntax as Actionscript (flash).
It would be an ideal language for shell scripting, making it easier to move code from the front and back end of a site, and less of the strange syntax of python.
Is there a good, javascript interpreter that is easy to install (I know there's one based on java, but that would mean installing all the java stuff to use),
Upvotes: 22
Views: 10741
Reputation: 24786
I personally use SpiderMonkey, but here's an extensive list of ECMAScript shells
Example spidermonkey install and use on Ubuntu:
$ sudo apt-get install spidermonkey
$ js myfile.js
output
$ js
js> var f = function(){};
js> f();
Upvotes: 13
Reputation: 39
Node.JS. It's great. Has many modules. you can do all your file scripting with Node.
Upvotes: 0
Reputation: 597511
Well, for safety reasons, javascript had not been provided with file access right by design. So as a scripting language, it's a bit limited.
But still, if you really want to, spider monkey is your best option. Here is a tuto :
http://developer.mozilla.org/en/Introduction_to_the_JavaScript_shell
Upvotes: 0
Reputation: 62681
On the 'easy to translate' theme, there's also Lua.
It's somewhat similar to Javascript, but more 'orthogonal' (closer to functional roots).
The heavy orientation to 'pure' programming theory has made it really small and fast. It's the fastest scripting language around, and the JIT runs circles around the new JavaScript JITs that are starting to appear.
Also, since it was originally thought as an extension language, it has a very nice and clean interface to C, making it very easy to create bindings to any C library you might want to access.
Upvotes: 2
Reputation: 200
FYI, there is a built-in one already on modern windows platforms. You need to use JScript, but it's close enough. Same environment also allows for VBScript. To run a program you can execute something like:
cscript foo.js
The windows system API is a bit weird and frustrating if you expect the same flexibility as with basic JS objects, but they do have thorough documentation if you can handle digging through the MSDN pages and seeing all the examples in VBScript.
Not sure what's available for Linux/Mac in terms of js shell.
Upvotes: 1
Reputation: 27786
You might try toying around with SquirrelFish or v8, both should be runnable on the command line.
Upvotes: 1
Reputation: 3259
Try jslibs, a scripting-focused standalone JS runtime and set of libraries that uses SpiderMonkey (the Gecko JS engine).
Upvotes: 4
Reputation:
You'll need some server-side JavaScript interpreter. Check out the following blog post. Something such as Rhino might be useful for you.
Upvotes: 1
Reputation: 71063
Of course, in Windows, the JavaScript interpreter is shipped with the OS.
Just run cscript
or wscript
against any .js file.
Upvotes: 10
Reputation: 32563
There are four big javascript interpreters currently. V8, Squirrelfish, Spidermonkey and Rhino. I think more important than performance is how well it integrates into existing infrastructure, and I guess Rhino with its bridge to Java wins here.
Upvotes: 7
Reputation: 5410
Google's V8 can be used as a standalone interpreter. Configuring with scons sample=shell
will build an executable named shell
, that can be called like so: ./shell file.js
.
Upvotes: 1
Reputation: 155
In my years I've found most Javascript developers find it quite easy to transfer over to PHP and vice versa - it isn't a direct answer to your question, although if you're working in ActionScript and JavaScript then you're best to stick with something like PHP (if you're not willing to move to Java, and stick with the ECMA base)
Upvotes: -2