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]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux