1 // echoToFile.js - Write in a given file all the parameters passed on the CLI
2 var fs = require('fs'),
3 system = require('system');
5 if (system.args.length < 3) {
6 console.log("Usage: echoToFile.js DESTINATION_FILE <arguments to echo...>");
12 for ( i= 2; i < system.args.length; ++i ) {
13 content += system.args[i] + (i === system.args.length-1 ? '' : ' ');
17 fs.write(system.args[1], content, 'w');