Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sys = require('sys');
- var exec = require('child_process').exec;
- var path = Math.floor(Math.random()*101);
- var fs = require('fs');
- fs.readFile('/home/shoutcast/mkdir.sh', function (err, data) {
- if (err) {
- return console.log(err);
- }
- console.log(data.toString());
- var result = data.toString().replace('NEWDIR="TEST"', 'NEWDIR="' + path + '"');
- fs.writeFile('/home/shoutcast/mkdir.sh', result, function (err) {
- if (err) return console.log(err);
- function puts(error, stdout, stderr) { sys.puts(stdout) }
- exec("bash /home/shoutcast/mkdir.sh", puts);
- }
- );
- });
- //Extra write to write path (whole process isn't done yet, still need to add variables and whatnot but I'm stuck on this, no matter where I place it.
- fs.writeFile('/home/shoutcast/lastdir', path, function (err) {
- if (err) return console.log(err);
- }
- root@fuzzyhost:~/NodeScripts# node script.js
- /root/NodeScripts/script.js:28
- });
- ^
- SyntaxError: Unexpected token }
- var sys = require('sys');
- var exec = require('child_process').exec;
- var path = Math.floor(Math.random()*101);
- var fs = require('fs');
- fs.readFile('/home/shoutcast/mkdir.sh', function (err, data) {
- if (err) {
- return console.log(err);
- }
- console.log(data.toString());
- var result = data.toString().replace('NEWDIR="TEST"', 'NEWDIR="' + path + '"');
- fs.writeFile('/home/shoutcast/mkdir.sh', result, function (err) {
- if (err) return console.log(err);
- function puts(error, stdout, stderr) { sys.puts(stdout) }
- exec("bash /home/shoutcast/mkdir.sh", puts);
- }
- //Extra write to write path (whole process isn't done yet, still need to add variables and whatnot but I'm stuck on this, no matter where I place it.
- fs.writeFile('/home/shoutcast/lastdir', path, function (err) {
- if (err) return console.log(err);
- );
- });
- }
- root@fuzzyhost:~/NodeScripts# node script.js
- /root/NodeScripts/script.js:21
- fs.writeFile('/home/shoutcast/lastdir', path, function (err) {
- ^^
- SyntaxError: Unexpected identifier
- at Module._compile (module.js:439:25)
- at Object.Module._extensions..js (module.js:474:10)
- at Module.load (module.js:356:32)
- at Function.Module._load (module.js:312:12)
- at Function.Module.runMain (module.js:497:10)
- at startup (node.js:119:16)
- at node.js:901:3
Advertisement
Add Comment
Please, Sign In to add comment