Das kannst du auch in reinem Bash ueber cgi loesen.
Das geht z.B. so:
Apache2 installieren und cgid einschalten (auf Ubuntu getestet)
Code
apt-get update; apt-get install -y apache2
tee /etc/apache2/sites-enabled/000-default.conf >/dev/null <<EOF
<VirtualHost *:80>
ServerName example.org
ServerAdmin webmaster@example.org
DocumentRoot /var/www/html/
ScriptAlias "/index.html" "/usr/lib/cgi-bin/index.cgi"
ScriptAlias "/index" "/usr/lib/cgi-bin/index.cgi"
RedirectMatch 404 index.htsh
<Directory /var/www/html/>
AllowOverride none
Options -Indexes
Require all granted
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
Include conf-available/serve-cgi-bin.conf
</VirtualHost>
EOF
a2enmod cgid
service apache2 restart
Display More
/index und index.html wird auf - -> /usr/lib/cgi-bin/index.cgi umgeleitet
Jetzt bauchst du nur noch ein index.htsh Dokument erstellen:
Zwichen die Marker <?bash und ?> kommt dein !#Bash Script
HTML
<!DOCTYPE html>
<html>
<body>
<ul>
<?bash
for i in Buzz Rex Bo Hamm Slink Potato; do
echo "<li>$i</li>"
done
?>
</ul>
</body>
</html>
Display More
Als letzten Schritt brauchst du noch ein Script, dass dir daraus ein cgi script erstellt. htmt2cgi
https://github.com/tinoschroeter/bash_on_steroids
Dann wird daraus:
Bash
#!/bin/bash
echo Content-type: text/html
echo ""
## make POST and GET stings
## as bash variables available
if [ ! -z $CONTENT_LENGTH ] && [ "$CONTENT_LENGTH" -gt 0 ]; then
read -n $CONTENT_LENGTH POST_STRING <&0
eval `echo "${POST_STRING}"|tr '&' ';'`
fi
eval `echo "${QUERY_STRING}"|tr '&' ';'`
echo "<!DOCTYPE html>"
echo "<html>"
echo "<body>"
echo "<ul>"
for i in Buzz Rex Bo Hamm Slink Potato; do
echo "<li>$i</li>"
done
echo "</ul>"
echo "</body>"
echo "</html>"
Display More
Fertig ::)