We were working on a project and wanted to call a shell script from JavaScript. We tried to look for help online but were unable to find any good example for the same. Can someone point is in the right direction ? We tried child_process.exec, but we were unable to get anything out of it.
-
Shell script on the clients computer or are you talking about node.js or sth?crackmigg– crackmigg2013年06月26日 06:52:30 +00:00Commented Jun 26, 2013 at 6:52
-
Shell scripts on the clients computeruser1828941– user18289412013年06月26日 07:25:39 +00:00Commented Jun 26, 2013 at 7:25
-
What JavaScript environment? A browser? Something else?Quentin– Quentin2013年06月26日 08:05:55 +00:00Commented Jun 26, 2013 at 8:05
-
The poster is obviously talking about node.js: nodejs.org/api/child_process.htmlgeorg– georg2013年06月26日 09:39:41 +00:00Commented Jun 26, 2013 at 9:39
2 Answers 2
No. It would be such a gigantic security hole that any browser developer who allowed this would be [family-friendly censorship banner].
The right answer to this is Why do you want to do that?
Comments
As pointed out by l0b0, this isn't possible directly. You would need to set up some kind of web service on the server that the JavaScript can call. This service would then in turn call the shell script. But be careful.