Re: display directories only
On Mon, Jan 05, 2004 at 09:58:52AM -0800, Nano Nano wrote: On Mon, Jan 05, 2004 at 06:43:23PM +0100, Elimar Riesebieter wrote: On Mon, 05 Jan 2004 the mental interface of Rick Weinbender told: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. I am using the zShell zsh. In there it is easy: alias lsd='ls -lad *(/)' alias lsddots='ls -lad .*(/) #ls -d `find -type d -maxdepth 1` ? can't think of anything simpler Well those aliases are, for a start - only one process. Here are some for sh: alias lsd='ls -d */' -- Jon Dowland http://jon.dowland.name/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: display directories only
On Tue, 06 Jan 2004 11:44:51 +, Jonathan Dowland wrote: On Mon, Jan 05, 2004 at 09:58:52AM -0800, Nano Nano wrote: On Mon, Jan 05, 2004 at 06:43:23PM +0100, Elimar Riesebieter wrote: On Mon, 05 Jan 2004 the mental interface of Rick Weinbender told: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. I am using the zShell zsh. In there it is easy: alias lsd='ls -lad *(/)' alias lsddots='ls -lad .*(/) #ls -d `find -type d -maxdepth 1` ? can't think of anything simpler Well those aliases are, for a start - only one process. Here are some for sh: alias lsd='ls -d */' Aliases are so last-century, though. lsd() { ls -d */; } -- paul Programming without a hex editor is like watchmaking without a hammer. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: display directories only
On Mon, Jan 05, 2004 at 08:47:38AM -0600, Rick Weinbender wrote: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. You can fake it like this: ls -l | grep ^d That's a bit grotty, of course. Better would be to use 'find'. Cheers, -- Colin Watson [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: display directories only
On Mon, 2004-01-05 at 15:47, Rick Weinbender wrote: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. A bare ls cannot do that ... it needs some assistance: ls -l | grep ^d -alf -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: display directories only
Rick Weinbender([EMAIL PROTECTED]) is reported to have said: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. man ls -- Goto, n.: A programming tool that exists to allow structured programmers to complain about unstructured programmers -- Ray Simard ___ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: display directories only
Alf Werder wrote: On Mon, 2004-01-05 at 15:47, Rick Weinbender wrote: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. A bare ls cannot do that ... it needs some assistance: ls -l | grep ^d -alf -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED] ** Thanks! That works great. -Rick -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: display directories only
On Mon, 05 Jan 2004 08:47:38 -0600 Rick Weinbender [EMAIL PROTECTED] wrote: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. Thanks, -Rick I don't know if this is of any use; it's what I use:- == #!/bin/sh # ldirs - Richard Kimber # # By default ldirs lists all the sub-directories in the current directory # in columns. It has the syntax: ldirs [-h] [path of directory] # -h will cause dot directories not to be listed # specifying a directory path will list the sub-directories in the # directory specified. ldirs --version will print the version number of # ldirs ldirs --help will print a simple help message ver=0.1 date=6 Dec 2000 arg1=$1 arg2=$2 narg=$# if [ ${#arg1} -eq 1 ] then num1=`expr ${#arg1} + 1` num2=`expr ${#arg2} + 1` else num1=`expr ${#arg1} + 2` num2=`expr ${#arg2} + 2` fi if [ $narg -eq 0 ] then find . -type d -maxdepth 1|sed s/^.\///g|sort|tail +2|column elif [ $narg -eq 1 -a $arg1 = -h ] then find . -type d -maxdepth 1|sed s/^.\///g|sort|sed /^\./d|column elif [ $narg -eq 1 -a $arg1 = --help ] then echo echo ldirs ver $ver Richard Kimber $date echoldirs [-h][path] echo -h hides dot files echo By default ldirs lists the current directory echo a path argument lists directories in that path echo ldirs --version gives the version number echo ldirs --help lists this help elif [ $narg -eq 1 -a $arg1 = '--version' ] then echo ldirs ver $ver elif [ $narg -eq 1 -a ! -d $arg1 ] then echo path does not exist elif [ $narg -eq 1 -a -d $arg1 ] then find $arg1 -type d -maxdepth 1|cut -b $num1-|sort|column elif [ $narg -eq 2 -a ! -d $arg2 ] then echo path does not exist, or parameters in wrong order elif [ $narg -eq 2 -a -d $arg2 ] then find $arg2 -type d -maxdepth 1|cut -b $num2-|sort|sed /^\./d|column else echo echo Aaargh! ldirs does not understand echo ver $ver by Richard Kimber $date echo ldirs [-h][path] echo -h hides dot files echo by default ldirs lists the current directory echo a path argument lists directories in that path echo ldirs --version gives the version number echo ldirs --help lists this help fi == - Richard. -- Richard Kimber http://www.psr.keele.ac.uk/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: display directories only
On Monday 05 January 2004 09:59, Rick Weinbender wrote: Alf Werder wrote: On Mon, 2004-01-05 at 15:47, Rick Weinbender wrote: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. A bare ls cannot do that ... it needs some assistance: ls -l | grep ^d -alf -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED] ** Thanks! That works great. -Rick this one works for me ls -ld */ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: display directories only
On Monday 05 January 2004 16:10, Rick Weinbender wrote: Alf Werder wrote: On Mon, 2004-01-05 at 15:47, Rick Weinbender wrote: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. A bare ls cannot do that ... it needs some assistance: ls -l | grep ^d You might also be interested in ``tree -d''. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: display directories only
On Mon, 05 Jan 2004 the mental interface of Rick Weinbender told: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. I am using the zShell zsh. In there it is easy: alias lsd='ls -lad *(/)' alias lsddots='ls -lad .*(/) Ciao Elimar -- Alles was viel bedacht wird ist bedenklich!;-) Friedrich Nietzsche pgp0.pgp Description: PGP signature
Re: display directories only
On Mon, Jan 05, 2004 at 06:43:23PM +0100, Elimar Riesebieter wrote: On Mon, 05 Jan 2004 the mental interface of Rick Weinbender told: I have a basic question. Is there a method using ls from the command line to have it display only directories. I've looked thru the help (ls --help), but cant' guess the right switches. I am using the zShell zsh. In there it is easy: alias lsd='ls -lad *(/)' alias lsddots='ls -lad .*(/) #ls -d `find -type d -maxdepth 1` ? can't think of anything simpler -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]