I am designing a javascript utility which needs to grep a password file ('ypcat passwd | grep ') in Unix. PERL uses "backtick" or System to run the command line. Python uses os.system. Is there a similar method in javascript?
-
explore child_process in nodejs, you can use something like : let {exec} = require("child_process"); exec("cmd")Manish Singh– Manish Singh2021-05-10 20:26:55 +00:00Commented May 10, 2021 at 20:26
-
Did you mean in node.js? (if so, add the tag)Wyck– Wyck2021-05-10 20:41:52 +00:00Commented May 10, 2021 at 20:41
Add a comment
|
2 Answers
Yes sir there is https://nodejs.org/docs/latest/api/child_process.html It's child_process.exec()
Comments
I don't believe there is a similar method within native JavaScript, but you may be able to achieve this using NodeJS.
Check this out, https://nodejs.org/api/os.html