[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Unidentified subject!



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 debian-user-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
begin:vcard 
n:Roman;Dean
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:droman@chattycow.com
x-mozilla-cpt:;-1312
fn:Dean Roman
end:vcard

Reply to: