Directory listing - Calling shell script from a CGI script
I had written a shell script to display directories and files. I am calling this shell script from a CGI script. When I open this CGI script from my browser (firefox zero point eight) the shell script is getting called and it displays all files and directories. This is my shell script,
echo "Content-type: text/html"
echo '<html> <head> <title> CGI </title> </head> </html>'
for i in `ls /home/seran/files/`
if [ -d /home/seran/files/$i ]
echo "<a href=/home/seran/files/$i> <img src=file:///home/seran/folder.png/> $i </a><br>"
echo "<a href=/home/seran/files/$i> $i </a> <br>"
This is the CGI-script,
<input name=q size=30 value="">
When I click on file names(all text files), the file contents are displayed inside my browser window. If I click on directory links I have to open that directory, and I have to display all contents in that directory. This should go on recursively. How to do this?
Do I have to change my shell script or CGI script to do this? Can anyone give me some ideas? I will try it out. Thanks in advance.