Re: Bash globbing files only?

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

 



On 31Jan2007 08:47, Daniel Qarras <dqarras@xxxxxxxxx> wrote:
| > A POSIX shell requires that the test command supports this:
| > 
| >        -h  file
| >               True if file exists and is a symbolic link.
| >        -L  file
| >               True if file exists and is a symbolic link.
| 
| Thanks, I already saw those but initially they did not work for
| directories. That was because I had
| 
| dirs=[^.]*/
| 
| that would expand, e.g:
| 
| foo/
| bar/
| 
| and the trailing slash caused -L test to fail.

Indeed, because it forces a test to be _not_ on the symlink but on what
is on the far side of it.

BTW, if you've been following this thread you should know that:

  [^.]*/

is better written:

  */

which means _exactly_ the same thing.

Of course, you realise that you may not need to test for -d at all
because */ will only return directories (or things pointing at them).
(Except when there are no directories at all - the it returns "*/"
unchanged and you just need to test for existence.)

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Haven't been there. Don't want to go. Don't need another t-shirt!
        - Lisa Varner <varner@xxxxxxxxxxxxxxxxxxxxxx>

[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