Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
how to display all folders (bash shell script)
Results 1 to 3 of 3

Thread: how to display all folders (bash shell script)

Hybrid View

  1. #1

    how to display all folders (bash shell script)

    hi,

    Code:
    #!/bin/bash
    for var in `find /home/ -type d | \
    sed -e "s/\/home\///"`; do
    echo $var
    done
    in this code to display
    Code:
    user1/public_html/XXXX/XXXX
    user1/XXX/XXXX/XXXX/XXXX/XXXX
    user2/XXXXXX/XXXX/XXXX/XXXX/XXXX
    user2/XXXX/XXXX/XXXX/XXXX/XXXX
    user2/XXX/XXXX/XXXX/XXXX
    user3/XX/XXXX/XXXX/XXXX/XXXX
    what code to display (use for loop)
    Code:
    user1
    user2
    user3

  2. #2
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811
    So you only want to pick out the <USER> part of your find request ?
    Code:
    for var in `find /home/ -type d | awk -F / '{print $3}' |uniq`; do echo $var done
    Or you just want to show which <USER> there are located in /home ?
    Code:
    for var in `ls /home/*`; do echo $var done
    Don't worry Ma'am. We're university students, - We know what We're doing.
    'Ruiat coelum, fiat voluntas tua.'
    Datalogi - en livsstil; Intet liv, ingen stil.

  3. #3
    tnx redhead for reply

    this code will be need
    Code:
    #!/bin/bash
    for var in `find /home/ -type d -maxdepth 1 | \
    sed -e "s/\/home\///"`; do
    echo $var
    done

Similar Threads

  1. Help with bash script
    By woodson2 in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 12-30-2010, 07:19 PM
  2. Need of shell script
    By Hariharan in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 09-16-2010, 02:34 PM
  3. SSH and bash script
    By vwgtiturbo in forum Programming
    Replies: 7
    Last Post: 12-25-2008, 05:40 AM
  4. Linux novice pleads: Please help with inherited BASH shell
    By linda_mo in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 04-06-2006, 01:40 AM
  5. Help with bash script
    By tolstoy in forum Programming
    Replies: 5
    Last Post: 05-21-2002, 11:17 AM

Bookmarks

Posting Permissions

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