Re: Bash globbing files only?

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

 



On 1/29/07, James Wilkinson <fedora@xxxxxxxxxxxxxxxxxx> wrote:
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 :)


The closest I could come up with was using
ls -Ap -I "pattern"

That caused directories to have / at the end of them. So I figured I
could use -I to ignore any filename ending with /.  However after a
few unsuccessfull variations I realized that the / is only displayed
at the end of directories therefore not part of the name. Which means
you cannot use a pattern to eliminate names ending in / (because the
name doesn't end with /, rather / is simply displayed after a
directory name).  Piping to grep would do it of course.

The find command with maxdepth and for type f is your best bet in my opinion.

If you come up with a way to do it from within ls I'd be interested in it.

Now lsattr comes close as well in that it lists files, but also
symbolic links to a directory.  But that produces the attributes along
with the file names.

Like John, I can see no way on how to do it with ls alone from within
bash. Clearly John has a solution for you using another shell so you
could call upon that shell interpreter.  But I don't see zsh on my
default FC6 install.

Jacques B.

Jacques B.

[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