Javascript 如何从HTML页面运行shell脚本?

Javascript 如何从HTML页面运行shell脚本?,javascript,html,shell,Javascript,Html,Shell,我想在html页面上创建一个按钮和一个输入框input.html,单击该页面时,将执行一个shell脚本test.sh。shell脚本应将该输入框字符串作为参数。shell脚本创建了一个html文件out.html(我已经创建了shell脚本,当获取一个输入字符串时,它会生成一个html文件),然后我想在原始html页面input.html上显示它 我该怎么做?假设一切都在本地运行,即这里没有服务器。浏览器不允许这样做,如果可能的话,这会破坏互联网,让黑客非常高兴,但这可以通过Firefox/C

我想在html页面上创建一个按钮和一个输入框
input.html
,单击该页面时,将执行一个shell脚本
test.sh
。shell脚本应将该输入框字符串作为参数。shell脚本创建了一个html文件
out.html
(我已经创建了shell脚本,当获取一个输入字符串时,它会生成一个html文件),然后我想在原始html页面
input.html
上显示它


我该怎么做?假设一切都在本地运行,即这里没有服务器。

浏览器不允许这样做,如果可能的话,这会破坏互联网,让黑客非常高兴,但这可以通过Firefox/Chrome插件或IE activeX控件实现

通常,终端上的网站脚本会给您一个类似以下的命令,您可以复制并粘贴到终端:

curl -sS https://example.com/script.sh | sh
示例:
您可能希望尝试从服务器端语言(如PHP)加载它



要从html页面执行shell脚本,您肯定需要一台服务器。如果没有服务器进行某种预处理,您无法执行此操作。
# meteor.js
curl https://install.meteor.com/ | sudo sh

# node.js
curl -sL https://deb.nodesource.com/setup | bash -

# Composer
curl -sS https://getcomposer.org/installer | php
<?php
if ($_GET['run']) {
  # This code will run if ?run=true is set.
  exec("/path/to/name.sh");
}
?>

<!-- This link will add ?run=true to your URL, myfilename.php?run=true -->
<a href="?run=true">Click Me!</a>