[英]Javascript from shell script
Is it possible to call javascript inside a shell script? 是否可以在shell脚本中调用javascript? For example,
例如,
echo "Content-type: text/html"
echo "
<html>
<script type="text/javascript">
document.write("<p>" + Date() + "</p>");
</script>
</html>
"
默认情况下:否。但您可以安装可运行javascript(如node.js或rhino)的应用程序。
If your script is used by CGI (Common Gateway Interface) application, then yes, you can include HTML with embedded JavaScript. 如果您的脚本由CGI(通用网关接口)应用程序使用,那么您可以使用嵌入式JavaScript包含HTML。
EDIT: JavaScript is a client-side technology. 编辑:JavaScript是一种客户端技术。 You won't get any trace of JavaScript running on server, because it won't be executed on server (unless we're talking about Server Side JavaScript but I don't think so).
您将无法获得在服务器上运行的任何JavaScript跟踪,因为它不会在服务器上执行(除非我们讨论的是Server Side JavaScript,但我不这么认为)。
试试RhinoShell 。
You'll need to install a javascript engine on your system to be able to call it from bash and execute your javascript code. 您需要在系统上安装javascript引擎才能从bash调用它并执行您的javascript代码。 Check SpiderMonkey .
检查SpiderMonkey 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.