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