Re: Bash globbing files only?

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

 



> > 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

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux