Or ... find -type d -maxdepth 1
At Tue, 17 Apr 2001 18:58:18 -0700 , "Dean A. Roman" <[EMAIL PROTECTED]> wrote: >Another easy way is to issue the command: > >ls -l | grep "^d" > > >Thanks, > ---Dean Roman. > > > >Unknown wrote: > >> What is the best way to get the equivalent of the DOS command >> "dir /ad" in linux? That command will show just the (sub)directories >> and not ordinary files. >> >> I thought that "ls -d" would be the equivalent but it is not. >> >> I know I can do "ls -f | grep /" to get the directory, but putting it >> into a script like this fails because the / does not appear when the >> output of ls is redirected: >> ----------------------------------- >> #!/bin/sh >> if [ ! -z "$1" ] >> then >> WAAR=$1 >> else >> WAAR=. >> fi >> ls -f $WAAR | grep / >> ---------------------------------- >> >> The following script works: >> ----------------------------- >> #!/bin/sh >> if [ ! -z "$1" ] >> then >> WAAR=$1 >> else >> WAAR=. >> fi >> ls -la $WAAR | grep ^d >> ----------------------------- >> >> Is there another way of doing this? >> Johann >> -- >> J.H. Spies - Tel. 082 782 0336. Posbus 4668, Tygervallei 7536 >> "But seek ye first the kingdom of God, and his >> righteousness; and all these things shall be added >> unto you." Matthew 6:33 >> >> -- >> To UNSUBSCRIBE, email to [EMAIL PROTECTED] >> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > Get your own FREE E-mail address at http://www.linuxfreemail.com Linux FREE Mail is 100% FREE, 100% Linux, and 100% yours!