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

Re: Simple sh or alias to list directories



Perfect,

Thanks very much.  I have just added a bit so that I can list
directories recursively.  E.g.

lsd -R 

At present file "~/home/bin/lsd" is
--<snip>--
#!/bin/sh

if [ $1 ]; then
    if [ $1 = "-R" ]; then
	MAXDEPTH=""
	DIR=$2
	#echo $1 MAXDEPTH = $MAXDEPTH
    fi
else 
    MAXDEPTH="-maxdepth 1"
    DIR=$1
    #echo $1 MAXDEPTH = $MAXDEPTH
fi

if [ $DIR ]; then
    find $DIR $MAXDEPTH -mindepth 1 -type d
else
    find $PWD $MAXDEPTH -mindepth 1 -type d
fi
exit
--<snip>--

Tom

On Tue, 17 Oct 2000, Timo Benk wrote:
> On Tue, 17 Oct 2000, Thomas Halahan wrote:
> 
> > I am trying to determine an easy alias or sh script that will list
> > only the directories in a directory.  It should have similar
> > functionality to the ls command.  E.g.
> > 
> > [tom]$ lsd ~
> 
> Try this one:
> 
> --<snip>--
> #!/bin/sh
> 
> if [ $1 ]; then
>     find $1 -maxdepth 1 -type d
> else
>     find $PWD -maxdepth 1 -type d
> fi
> --<snap>--
> 
>      Ciao,
>          Timo<t_benk@gmx.de>
> --
> 
>     .-'~~~-.	   
>    .'o oOOOo`.      | Timo Benk	
>   ;~~~-.oOo   o`.   | Germany
>    `. \ ~-.  oOOo.  | Fax/Voicemail:    +49891488214215
>      `.; / ~.  OO:  | 
>      .'  ;-- `.o.'  | 
>     ,' ; ~~--'~     | [ASCII stolen from Mescalito Ted]
>     ;  ;            |  
> _\\;_\\//_          
> 
> 
> -- 
> Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null



Reply to: