Re: ls lacking a feature?
- From: Richard Heathfield <invalid@xxxxxxxxxxxxxxx>
- Date: Wed, 28 Jun 2006 22:16:02 +0000
Bernard Liang said:
Well,
....you just want the directory name, not all the gubbins, so you thought
you'd try:
ls -l | grep ^d | tr -s ' ' | cut -d' ' -f9
This is slightly shorter:
ls -al | grep ^d | awk '{ print $9 }'
seems to do the trick for me, but this is a very cheap hack,
Yes.
and is
dependent on what fields ls decides to print.
Yes.
I am definitely not
convinced this is the best method, but unfortunately this is the
simplest one I know that works.
It's fairly easy to write a C program to do this, if nobody comes up with a
better idea - and such a program would /not/ rely on the fields ls decides
to print.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.
- Follow-Ups:
- Re: ls lacking a feature?
- From: John W. Krahn
- 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):