Hi,
I'm learning some simple cgi scripting. I can make a script like this,
so my browser shows "Hello World"
/www/cgi-bin/name.sh
---
#!/bin/sh
MyName=World
echo "<html> Hello $MyName </html>"
---
What I'd like is to have a separate html and script files in the cgi folder so
the script generates variables that are used in the html
Something like:
/www/cgi-bin/name.sh
---
#!/bin/sh
MyName=World
cat name.html
---
and
/www/cgi-bin/name.html
<html><h1>Hello $MyName<br>
</form></body></html>
---
Now this does not work as cat doesn't replace the varaible. I've also tried
a looped echo of the html file but again that doesn't work.
So my question, how to most elegantly do this ?
It would be cool to have a general solution that could replace many variables in the html file.
Many Thanks