在shell脚本中调用JavaScript是可能的吗?例如,
echo "Content-type: text/html"
echo "
<html>
<script type="text/javascript">
document.write("<p>" + Date() + "</p>");
</script>
</html>
"
在shell脚本中调用JavaScript是可能的吗?例如,
echo "Content-type: text/html"
echo "
<html>
<script type="text/javascript">
document.write("<p>" + Date() + "</p>");
</script>
</html>
"
node name_of_script.js
从 shell 脚本启动一个 node.js 脚本。 - Anderson Green如果你想要从bash中调用并执行你的javascript代码,你需要在你的系统上安装一个javascript引擎。可以查看SpiderMonkey。