[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Bash globbing files only?
- From: Daniel Qarras <dqarras yahoo com>
- To: For users of Fedora <fedora-list redhat com>
- Subject: Re: Bash globbing files only?
- Date: Mon, 29 Jan 2007 10:18:27 -0800 (PST)
> > with Bash one can list directories (excluding dot dirs) like this:
> >
> > ls [^.]*/
> >
> > How can I list files instead of directories with Bash? I thought
> this
> > would be trivial but I can't find a solution anywhere.
>
> I don't think that it can be done with bash, but if you don't mind
> switching to zsh -- another extended version of the Bourne shell --
> it does become trivial:
>
> ~% ls *(.) # list only plain files
> ~% ls *(/) # list only directories
> ~% ls *(*) # list only executable files
Yes, I am painfully aware of the power of zsh :) But in this case I
need to do my script with bash and it seems that although globbing for
directories is trivial ( */ ) there is no similar pattern to match
files. Oh, well, I guess I'll need to waste some CPU cycles and launch
find everytime I need to know file names in the current directory.
Thanks.
____________________________________________________________________________________
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]