1

I have a simple shell script:

#!/bin/bash
echo "hello john"

And I also have a very basic server file:

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  /*
  Code to execute the shell script
  */
});

var server = app.listen(3000, function () {
  var host = server.address().address;
  var port = server.address().port;
  console.log('App listening at http://%s:%s', host, port);
});
Phil Smith
  • 11
  • 1
  • What have you tried? Have you [read the documentation](http://nodejs.org/api/child_process.html#child_process_child_process)? Did you [try googling your question](https://www.google.com/search?q=How+to+execute+a+shell+script+with+node%3F)? – Jordan Running Feb 04 '15 at 23:44
  • http://nodejs.org/api/child_process.html – qqibrow Feb 04 '15 at 23:44
  • [This](http://stackoverflow.com/questions/8389974/how-to-run-commands-via-nodejs-child-process) Will be helpful to – Ethaan Feb 04 '15 at 23:46

0 Answers0