从bash脚本运行javascript

从bash脚本运行javascript,javascript,bash,Javascript,Bash,我刚开始学习bash脚本编程,想知道这里是否有人知道如何执行通常嵌入到html页面中的javascript 因此,在bash脚本中,我想执行(例如): 非常感谢所有人的帮助。您需要一个类似的Javascript运行时 要评估代码片段:$node-e“console.log('hello')” 要运行脚本:$node script.js使用env-like如何: 我的档案 #!/usr/bin/env node console.log("hello from test file&qu

我刚开始学习bash脚本编程,想知道这里是否有人知道如何执行通常嵌入到html页面中的javascript

因此,在bash脚本中,我想执行(例如):


非常感谢所有人的帮助。

您需要一个类似的Javascript运行时

要评估代码片段:
$node-e“console.log('hello')”


要运行脚本:
$node script.js

使用env-like如何:

我的档案

#!/usr/bin/env node

console.log("hello from test file");
使文件可执行

chmod +x my-file
然后运行它:

node my-file
hello from test file
节点?可能是重复的,但答案大部分是4年前的,有几个不再有用。