![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Want to Get List of All directories | niceboykunal123 | Shell Programming and Scripting | 7 | 06-10-2009 02:05 AM |
| list only directories in commandline. | jhmr7 | UNIX for Dummies Questions & Answers | 9 | 06-10-2009 02:01 AM |
| command to list a only sub-directories | mail2sant | UNIX for Dummies Questions & Answers | 1 | 05-09-2008 10:11 AM |
| How to list only directories? | videsh77 | UNIX for Dummies Questions & Answers | 4 | 01-09-2006 10:10 AM |
| List directories | malaymaru | UNIX for Dummies Questions & Answers | 3 | 09-25-2005 09:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
how to list directories only
I would like to know how to list directories only without a / at the end. I would like to only see them in my current dir.
for example ls - d */ gives dir1/ dir2/ dir3/ dir4/ but is there a way to get only dir1 dir2 dir3 i need it to use them as inputs in a foreach loop where i want to perform an action in my sub directories, but the / at the end is giving me problems thanks |
|
||||
|
echo `ls -d */ | cut -f 1 -d /` that gets rid of the "/" but then the output is as follows:
e.g. echo `ls -d */ | cut -f 1 -d /` gives dir1 dir2 dir3 dir4 dir5 dir6 etc if you use it without the echo and it works fine ls -d */ | cut -f 1 -d / dir1 dir2 dir3 ... Peace Last edited by Ecclesiastes; 04-26-2006 at 04:32 AM.. |
|
||||
|
Quote:
probably you might have set an alias for ls as ls='ls -F' check in your .profile else use the full path /bin/ls |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|