我有一个bash cgi脚本,它运行一些命令和可执行文件,最后它在一个新目录中创建一个结果zip文件。以下是bashcgi.sh文件代码:
#!/bin/sh
echo "Content-type: text/html"
echo '<!DOCTYPE html>'
echo '<html lang="en">'
echo ' <head> '
echo ' <h1><a href="/test/index.html">Test</a></h1>'
echo ' </head>
echo '<body>'
**my script and variables here**
echo 'Download the output files: '
echo '<a href="/var/htdocs/test/$variableOutput/output.zip">click here to download result</a><br> '
echo '</body>
echo '</html>上述脚本文件位于"/var/cgi-bin/“中,其中有许多变量,并在var/htdocs/test/中创建了一个输出文件夹。文件夹名根据用户输入而改变(在以前的php中,输入名称将保存为文本文件)。有没有办法在href中给出该变量文件夹的链接?也就是说,当用户点击链接时,他们应该被重定向到名称为variable folder的链接。例如,如果是$variableOutput = testresult1,则应重定向到/var/htdocs/test/testresult1/output.zip。
https://stackoverflow.com/questions/38300645
复制相似问题