1

Trying to call a bash-scripts's function from another script written in NodeJS.

user3604158
  • 55
  • 1
  • 1
  • 5

1 Answers1

0

You can run a bash script in Node.js using child_process' exec

var exec = require('child_process').exec;

exec('./yourscript.sh <args>',
  function (error, stdout, stderr) {
    console.log('stdout: ' + stdout);
    console.log('stderr: ' + stderr);
    if (error !== null) {
      console.log('exec error: ' + error);
    }
});
alejandromav
  • 933
  • 1
  • 11
  • 24