Raydot
asked on
Simple CGI Question
I'm guessing this one isn't tough. I'm going though a book on CGI, and I typed in my script, and put it in the cgi-bin on our server, and set the permissions properly, except it only sort of works. I keep getting an error:
...ourserver/cgi-bin/pingl aura.cgi: echo: not found
Here's the script, which I've triple-checked for errors (yes, you may recognize it from Laura Lemay's book on HTML):
#!/bin/sh
echo "Content-type: text/html"
echo
echo "<HTML><HEAD>"
echo "<TITLE>Is Laura There?</TITLE>"
echo"</HEAD><BODY>"
ison='who | grep lemay'
if [ ! -z "$ison" ]; then
echo "<P>Laura is logged in"
else
echo "<P>Laura isn't logged in"
fi
echo "</BODY></HTML>"
The book says something about leaving a blank line after the header, but I'm not sure what that is in a CGI script. The HTML is really just an HREF to this script. I'm running on a Windows NT box. Can anyone help? Is it because that opening line (#!/bin/sh) is UNIX?
Thanks,
Dave.
...ourserver/cgi-bin/pingl
Here's the script, which I've triple-checked for errors (yes, you may recognize it from Laura Lemay's book on HTML):
#!/bin/sh
echo "Content-type: text/html"
echo
echo "<HTML><HEAD>"
echo "<TITLE>Is Laura There?</TITLE>"
echo"</HEAD><BODY>"
ison='who | grep lemay'
if [ ! -z "$ison" ]; then
echo "<P>Laura is logged in"
else
echo "<P>Laura isn't logged in"
fi
echo "</BODY></HTML>"
The book says something about leaving a blank line after the header, but I'm not sure what that is in a CGI script. The HTML is really just an HREF to this script. I'm running on a Windows NT box. Can anyone help? Is it because that opening line (#!/bin/sh) is UNIX?
Thanks,
Dave.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah, it was simpler than I thought! One check with our Web Guru and he told me that he hasn't EVER had luck doing what I'm trying to do. So, we came up with the idea (with the generous help of the PERL mailing list) to just Telnet straight into the UNIX servers, and I'll just write the scripts straight in the language in which they were meant to be written. Thanks julio.
Of course that won't work, since that IS a Unix shell script!
It CANNOT run on an NT box.
I'm afraid you won't be able to test any samples in your book.
Cheers, julio