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/pinglaura.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.
LVL 3
RaydotAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

julio011597Commented:
It seems that your cgi cannot find the 'echo' command.
This should be a PATH problem.
You could ask your sys admin which is the full path to the echo command, then add a line to your script this way:

(say, echo is in /usr/bin)

--//--
#!/bin/sh
PATH=$PATH:/usr/bin #<-- line to add
...
--//--

If this does not work either, it's a permission problem, i.e. the web server user (usually 'nobody') cannot access the echo comand at all.
Again, ask your sys admin to set up the appropriate permissions.

HTH, julio
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
julio011597Commented:
SORRY, i didn't notice that: run and reject my answer!

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
0
RaydotAuthor Commented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.