Re: Bash globbing files only?

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

 



Daniel Qarras wrote:
> I want just the files from the current directory, not from any subdir.
> And I'd prefer some bash globbing if possible for performance/elegancy
> reasons :)

Les Mikesell wrote:
> The only way to do it without an external command would be to expand
> the list in the shell and cycle though the list eliminating the
> directories with a [ -d $VAR ] test. See 'man test' for the options,
> but it really is a shell built-in.

That won't work reliably, either -- directories can contain more things
than plain files or subdirectories. There could be symbolic links,
character or block device nodes, named pipes or sockets.

Daniel should probably briefly consider what he wants to do with any of
these, and program around them. (I suspect "following symbolic links and
ignoring the rest" may be a good heuristic".)

Hope this helps,

James.

-- 
E-mail:     james@ | A wood-pigeon would, If a wood-pigeon could,
aprilcottage.co.uk | But a wood-pigeon can't, So it won't.
                   | A wood-pigeon could, If a wood-pigeon would,
                   | But a wood-pigeon doesn't want to. So it doesn't.

[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