0

I have a homepage ./index.html, and on this page I would like to display a variable that was created in my ./cgi-bin/print_ip.sh file.

What is the cleanest way of accomplishing this?

5
  • 2
    The cleaner way is to have index.html generated dynamically. The easier way is to have a small iframe. If it should remain static and you want it well integrated into the page, use a bit of JS to request the value and insert it into the page. Commented Mar 18, 2019 at 21:02
  • How would the javascript retrieve this variable from the cgi bash script? ip=$(curl http://169.254.169.254/latest/meta-data/local-ipv4) Commented Mar 18, 2019 at 21:08
  • The cgi bash script would have to output it Commented Mar 18, 2019 at 21:12
  • The bash script does output it as part of the html it renders, is there a method for in javascript for retrieving from this generated html file? Commented Mar 18, 2019 at 21:27
  • 1
    People often use jquery to fetch a page Commented Mar 18, 2019 at 21:32

1 Answer 1

0

if you can use shtml, take a look at here https://www.computerhope.com/jargon/s/shtml.htm

shtml is like html where you can dynamicly include some stuff from the webserver:

<!--#exec cmd="cgi-bin/mycounter.cgi" -->
<!--#include virtual="/cgi-bin/mycounter.cgi" -->
<insert file="cgi-bin/mycounter.cgi">
<!--#echo var="DATE_LOCAL" -->
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.