b-boy
September 14th, 2009, 10:28 AM
Hi guys I have apache2 installed and I want to run a few bash commands. I hvae tried a few examples but it does not work for me.
so here is the tutorial i followed http://www.yolinux.com/TUTORIALS/LinuxTutorialCgiShellScript.html
but basically here is the code in this file /var/www/cgi-bin/cat-a-text-page
#!/bin/sh
CAT=/bin/cat
COLCRT=/usr/bin/colcrt
echo Content-type: text/plain
echo ""
if [[ -x $CAT && -x $COLCRT ]]
then
$CAT $1 | $COLCRT
else
echo Cannot find command on this system.
fi
and on my index.html
<A HREF="/cgi-bin/cat-a-text-page?/home/user1/public_html/text-file.txt">Text of link</A>
all that happens when iclik on the link is it shows the bash script and not the output of the script.
Just a note the cgi-bin dir I created by my-self as it was not there and the part in the html code that is bold does not exist
so here is the tutorial i followed http://www.yolinux.com/TUTORIALS/LinuxTutorialCgiShellScript.html
but basically here is the code in this file /var/www/cgi-bin/cat-a-text-page
#!/bin/sh
CAT=/bin/cat
COLCRT=/usr/bin/colcrt
echo Content-type: text/plain
echo ""
if [[ -x $CAT && -x $COLCRT ]]
then
$CAT $1 | $COLCRT
else
echo Cannot find command on this system.
fi
and on my index.html
<A HREF="/cgi-bin/cat-a-text-page?/home/user1/public_html/text-file.txt">Text of link</A>
all that happens when iclik on the link is it shows the bash script and not the output of the script.
Just a note the cgi-bin dir I created by my-self as it was not there and the part in the html code that is bold does not exist