[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: cgi using shell script?



keerthi wrote (keerthi@xxxxxxxxxxxxx):

>   Is it possible to write a cgi program using shell scripts? 

Yes! CGI's can be written in _any_ language. The output (from stdout) of your
program gets sent to the client web browser (with some catches like the http
header).

Have a look at this example which prints the name of the web server
software/version and machine name -

=== snip ===
#!/bin/sh

# Print the http headers
echo Content-type: text/plain
echo
echo CGI/1.0 test script report:
echo
# Display some output
echo SERVER_SOFTWARE = $SERVER_SOFTWARE
echo SERVER_NAME = $SERVER_NAME
=== snip ===

You will need to name and place this file according to the setup of your
webserver (see below).

> If yes should i configure my browser?

CGIs are run on the webserver. No web browser config is necessary.
But there is some work involved in setting up the webserver to run cgi's
efficiently, but for simple learning/testing purposes it's pretty easy. If you
want to run your own webserver, start with something small... like "thttpd"
which is very easy to compile/configure. You can even set it up without any
root privilages. On the other hand, Apache is too feature rich and
intimidating for starters (and at times, even experts;-).

Good luck!

-Raja