You have to give execute permission, and then be called from the browser :
http://localhost/cgi-bin/gcgil
file: / usr / lib / cgi-bin / gcgil
The following code would be useful for you :
Code:
#! / Bin / bash
# Set the following variable to the name you want.
# It will be the script directory.
SCRIPTDIR = "script.cgi"
SCRIPTBASE = "ligcg.cf"
EXT = ". Cf"
# Far from be directed to an administrator ...
#
if [[$ (EUID) == 0]]; Then
echo "You should not use the Administrator!" echo
exit
fi
# Functions
####################
# UserStdOut
#
# No parameters. To differentiate between two users,
# The shell and the webserver
#
# End if a wrong call from the browser.
(userStdOut function
if ["$ NOCGI GATEWAY_INTERFACE" = "NOCGI"]; Then
# Normal output of characters per console
SCRIPTUID = 2
else
if ["/ $ SCRIPTDIR"! = "$ PATH_INFO"] & & \
[! -F "$ (SCRIPTDIR) / $ (SCRIPTBASE)"]; Then
set-f
echo 'Content-type: text / plain; charset = "UTF-8"'; echo
if ["$ PATH_INFO NOWD" = "NOWD"]; Then
echo "Corrects URL: http:// $ SERVER_NAME $ SCRIPT_NAME / $ SCRIPTDIR"
else
echo "This ... SCRIPTDIR only $ () / $ (SCRIPTBASE) has" \
"Authority to perform this action:))"
fi
exit
else
SCRIPTUID = 1
fi
fi
)
# If the file cgibin / bincgi not exist, create the function which will replace
# Temporarily that there Epera find.
#
if [-f $ SCRIPTDIR / $ SCRIPTBASE] Then
SCRIPTDIR $ source / $ SCRIPTBASE
else
(start function
in case $ SCRIPTUID
1) echo 'Content-type: text / plain; charset = "UTF-8"'; echo
cat <<_eOt_
Script Initializing ...
_eOt_
;; # This is the web server by. Need a notice that we do.;
2) clear
NOP = $ '\ X1B [0; 0m'
ROJ = $ '\ X1B [31; 01m'
BLA = $ '\ X1B [0; 01m'
VER = $ '\ X1B [32, 01m'
cat <<_eOt_
JRO $ (hello) $ (USER) $ (NOP)
're running this script ($ (VER) $ (basename $ 0) $ (NOP)) from a console
$ (BLA) $ (TERM) $ (VER) $ (tty) $ (NOP)
but is designed to run as \
CGI $ (VER) $ (NOP) and show it through web browser.
You put it in the directory of your cgi $ (BLA) $ (NOP)'s usually
$ (VER) / usr / lib / cgi-bin
/ Var / www / cgi-bin
NOP ...${)
and call it from the browser, for example
Http://localhost/cgi-bin/ $ (VER) $ (basename $ 0)
http:// $ (uname-n) / cgi-bin / $ (basename $ 0) $ (NOP)
See you in the browser ...
_eOt_
echo
exit
;; # Final output to the console:))
esac
if [-d $ SCRIPTDIR] Then
echo "Directory $ SCRIPTDIR echo there :))";
if [! -W $ SCRIPTDIR] Then
echo "but you must have write permission to $ (whoami)"; echo
echo "~ $ sudo chown $ (whoami): $ (GID) $ (dirname $ 0) / $ (SCRIPTDIR)
echo "although you can continue"
fi
else
echo "You need to create the directory $ (dirname $ 0) / $ (SCRIPTDIR)" echo
echo "for this from a console running"
echo "~ $ sudo mkdir $ (dirname $ 0) / $ (SCRIPTDIR)
echo "~ $ sudo chown $ (whoami): $ (GID) $ (dirname $ 0) / $ (SCRIPTDIR)
fi
echo, echo "finally located the file: \" $ SCRIPTDIR / $ SCRIPTBASE \ ""
echo "to complete the installation" echo
echo "$ (basename $ 0) to $ (whoami): Bye"
)
fi
userStdOut
start
exit
Bookmarks