Re: ls lacking a feature?
- From: "Rob Thorpe" <robert.thorpe@xxxxxxxxxxxx>
- Date: 29 Jun 2006 01:09:35 -0700
Bernard Liang wrote:
Well,
ls -l | grep ^d | tr -s ' ' | cut -d' ' -f9
seems to do the trick for me, but this is a very cheap hack, and is
dependent on what fields ls decides to print.
Many bits of Unix shell programming are cheap hacks.
For GNU ls the fields are unlikely to change, since so many other
programs rely on their format. The same is true for many other lses
though they may have slightly different formats.
I am definitely not
convinced this is the best method, but unfortunately this is the
simplest one I know that works.
I would do it using the "find" method already posted, putting it into a
bash subroutine in my .bashrc file, or a separate bash script.
-BL
Richard Heathfield wrote:
Bernard Liang said:
how does one perform the equivalent MS-DOS's "dir /a:d" (directory
listing) in *ix (say, linux)?
I use:
ls -al | grep ^d
but there's probably an easier way. :-)
.
- Follow-Ups:
- Re: ls lacking a feature?
- From: Phlip
- Re: ls lacking a feature?
- References:
- ls lacking a feature?
- From: Bernard Liang
- Re: ls lacking a feature?
- From: Richard Heathfield
- Re: ls lacking a feature?
- From: Bernard Liang
- ls lacking a feature?
- Prev by Date: Re: ls lacking a feature?
- Next by Date: Re: ls lacking a feature?
- Previous by thread: Re: ls lacking a feature?
- Next by thread: Re: ls lacking a feature?
- Index(es):