公告
财富商城
积分规则
提问
发文
2020-03-26 17:36发布
做自己的国王
I would like to execute an shell program who require any params with Node.js
How can I do that ?
From: http://www.dzone.com/snippets/execute-unix-command-nodejs
To execute shell commands:
var sys = require('sys') var exec = require('child_process').exec; exec('command', function (error, stdout, stderr) {});
From: Run shell script with node.js (childProcess),
To run a program bar.sh in your home folder with the argument 'foo':
var foo = 'foo'; exec('~/bar.sh ' + foo, function (error, stdout, stderr) { if (error !== null) { console.log(error); } else { console.log('stdout: ' + stdout); console.log('stderr: ' + stderr); } });
最多设置5个标签!
From: http://www.dzone.com/snippets/execute-unix-command-nodejs
To execute shell commands:
From: Run shell script with node.js (childProcess),
To run a program bar.sh in your home folder with the argument 'foo':