Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I want to know the how can i read the directories in shell script i.e to brief i want to write a shell script which automatically finds what ...
  1. #1
    Just Joined!
    Join Date
    Jun 2007
    Posts
    14

    Help Regarding Shell Scripting

    Hi all,
    I want to know the how can i read the directories in shell script i.e to brief i want to write a shell script which automatically finds what are all the directories and files present in the directory which it runs and prints it.
    Can any one let me know how can i do it. I also want to know which is the best book to learn shell scripting.

    Regards
    Yugandhar.

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Try the find command.
    Google for "manpage find examples".

    To learn Bash scripting you can check these pdf files:

    http://personal.riverusers.com/~theg.../abs-guide.pdf
    http://tldp.org/LDP/Bash-Beginners-G...ners-Guide.pdf

    Regards

  3. #3
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    452
    have you tried "ls -R" ?
    the sun is new every day (heraclitus)

  4. #4
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    If you want to do some work with directories/files within a script, look at the 'find' command. Here's an example of what's prossible, it lists the directories as a tree structure.

    # find ./ -type d -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'

    Vic

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...