简体   繁体   中英

variable href in cgi-bin

I have a bash cgi script which runs some command and executable files and in the end it creates a result zip files in a new directory. here is the bashcgi.sh file code:

#!/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>

The above script file is located in "/var/cgi-bin/" and which there are many variables and creates an output folder inside var/htdocs/test/ the folder name changes according to user input (in previous php, the input name will be saved as a text file) Is there any way to give link to that variable folder in href? that is when users click on the link they should be redirected to the link with name of variable folder. ex if $variableOutput = testresult1 they should redirect to /var/htdocs/test/testresult1/output.zip .

echo "<a href=/var/htdocs/test/$variableOutput/output.zip>click here to download result</a><br>"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM