In node.js you can pass the argument -i
to get an interactive console, and then pass -e
to evaluate a javascript statement.
I tried running:
$ node -i -e '.load ./someScript.js'
.load someScript.js;
^
SyntaxError: Unexpected token .
at Object.exports.runInThisContext (vm.js:53:16)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:410:26)
at node.js:578:27
at nextTickCallbackWith0Args (node.js:419:9)
at process._tickCallback (node.js:348:13)
And I get an error, but if I try to run the same thing from the interactive node prompt, it loads just fine; i.e.
> .load ./someScript.js
Is there something else I need to do to make this work?