Re: Bash globbing files only?

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

 



On 29Jan2007 21:29, Jacques B. <jjrboucher@xxxxxxxxx> wrote:
| >Try this:
| >
| >  set -x
| >  ls [^.]*/
| >  ls -d [^.]*/
| >  ls -d */
| >
| >It would be interesting to see what the differences are, if any.
| 
| Thanks for the tip & additional info.  The results of the above after
| doing unalias ls and set -x:
| 
| (directory names neutered slightly to protect the youngs)
| 
| ls [^.]*/
| + ls 'My son'\''s Passion/' Desktop/ download/ 'Final Material/'
| ftools/ images/ 'Linux Forensic Documents/' LPIC/ 'Other son -
| Profession/' Photos/ PicasaDocuments/ Presentations/ scripts/ thumb/
| 
| followed by the content of each of the above folders

So, as expected then, yes?

| The other two yield identical results, being:
| 
| + ls -d 'My son'\''s Passion/' Desktop/ download/ 'Final Material/'
| ftools/ images/ 'Linux Forensic Documents/' LPIC/ 'Other son -
| Profession/' Photos/ PicasaDocuments/ Presentations/ scripts/ thumb/
| 
| followed by the directory names above.

Good, also as expected.

| I like that trace feature - lets you see how the globbing gets
| expanded.  So we see that the original syntax yields the content of
| the directories, whereas as expected the -d only lists the directory
| names.
| Not to beat a dead horse, but I hate not understanding why something
| works (or doesn't work).  Why is it working on yours but not mine?
| Are you getting the same trace output for the ls [^.]*/ command, but
| without listing the contents of those directories, only the directory
| names?

I get what you get. We have established A) that "*/" and "[^.]*/"
are equivalent and B) that -d prevents burrowing into the directories.
We should have added:

  ls */

to the tests above to try all four permutations.

Does it make sense now?
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Kilimanjaro is a pretty tricky climb. Most of it's up, until you reach the
very, very top, and then it tends to slope away rather sharply.

[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