I have a fallowing CGI script, which does nothing more than prints out the values user inserted:
Code:
#!/bin/sh
echo "Content-type: text/html"
echo
ID=`echo "$QUERY_STRING" | sed -n 's/^.*id=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
TEXT=`echo "$QUERY_STRING" | sed -n 's/^.*text=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
echo "<html>"
echo "<head><title>SNMP script</title></head>"
echo "<body>"
if [ $ID ] && [ $TEXT ]
then
echo "Name is $ID <br>"
echo "IP address is $TEXT <br>"
else
echo "<h4>SNMP script</h4>"
echo "<form method=get>"
echo "Name: <input type=text name=id><br>"
echo "IP address: <input type=text name=text><br>"
echo "<input type=submit value=Generate>"
echo "</form>"
fi
echo "</body>"
echo "</html>"
If I insert
Martin to the name box and
192.168.1.1 to the IP box I get fallowing output:
Quote:
Name is Martin
IP address is 192.168.1.1
|
As you can see, script above works fine(I host this script in Apache server and use Firefox as a web-client). Now I made a fallowing bash script:
Code:
#!/bin/bash
if (($# < 1))
then
echo "USAGE: $0 IP1 IP2 IP3 IP4 etc"
else
echo Generated by $1
echo
while [ "$2" != "" ]; do
paste <(snmpwalk -v 2c -c public $2 ifdescr | sed 's/.*STRING: //') <(snmpwalk -v 2c -c public $2 ifalias | sed 's/.*STRING: //')
shift
done
fi
...which is started like this:
./script.sh Martin 192.168.1.1. Output is user name plus port numbers and descriptions. This bash script works fine as well
How can I combine those two scripts? I would like to insert name and IP to according boxes in Firefox and after clicking
Generate button, user name plus list of port numbers and descriptions will appear in Firefox window instead of terminal emulator window
How to link/combine those two scripts to work together as one?