ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

Hello,
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,

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.

Those red colored names are directories, if I click on directories my shell script has to open that directory and it has to display all files present in that particular directory. For example I have some C programs inside CFiles directory(/home/seran/CFiles/), after clicking on this CFiles directory the shell script has to display files present in that directory. This is not happening now.

I can open those xml and html files present in my home directory. Those file contents are displayed in my browser window.

The only problem is opening directories. If I click on a directory link, I have to open that directory, and I have to display files inside it. If it has some sub-directories and I clicked on it, again I have to open that sub-directory and I have to display files in it. This is the task I want to achieve.

I hope I had explained enough. If I get some ideas I can finish this quickly.

You'd need to make directory names be links to the cgi script, and pass the directory name to it as an argument. Out of curiousity, why don't you just use Apache's built in Directory Indexes to do this?