Skip to content

Instantly share code, notes, and snippets.

@pwittchen
Created January 17, 2017 16:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwittchen/fdfb0ec0af09211a7398c00d831acc48 to your computer and use it in GitHub Desktop.
Save pwittchen/fdfb0ec0af09211a7398c00d831acc48 to your computer and use it in GitHub Desktop.
executing shell command via JS - on Linux nodejs ifconfig.js; on macOS node ifconfig.js
var process = require('child_process');
process.exec('ifconfig',function (err,stdout,stderr) {
if (err) {
console.log("\n"+stderr);
} else {
console.log(stdout);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment