Re: Bash globbing files only?

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

 



Got an alias for "ls"? Try:

  unalias ls
  ls -d */

The -d says don't treat directories specially (normally ls lists
directory _contents_ if a directory is named).

I do have an alias for ls, but it's simply to add color.  I did the
unalias and get the same results.  Now with the one you have listed
here, I do get the directories.  Even when I source my .bashrc back to
get the alias back, it still works as expected.  So the alias is not
affecting my ls beyond adding color.

Is the command $ls [^.]*/
working as expected for you, listing only directories in your current directory?

I'm fairly comfortable with the basics of bash and some intermediate
bash but I hadn't played with globbing much.  In reading up on it I'm
left with the impression that the command above would list all files
not starting with a period ([^.]), then the wildcard * (so could be
anything at all), followed by the / (which doesn't seem to do
anything).

Even if it did work, would it not exclude any directory starting with
a period?  But that aside, does it work (or not work) for anyone else?

I have

GNU bash, version 3.1.17(1)-release (i686-redhat-linux-gnu)

Thanks,

Jacques

[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