Re: Problem with glob and filenames containing '[' and ']'



Michele Dondi wrote:
On Wed, 27 Sep 2006 12:33:26 +0100, David Squire
<David.Squire@xxxxxxxxxxxxxxxxxxxx> wrote:

I'm having trouble using glob to find filenames that contain '[' and

Well I'm a big fan of glob() myself, and I recommend using it
especially when I see people using lower level opendir() & C. in
situations in which it's not strictly necessary, but this may be a
situation in which it may indeed be good to do so.

I've just written a work around to do so :)

']', even though I am escaping those meta-characters. Here is an example
script and output:

However, I don't seem to have that problem:

C:\TEMP>touch foo[bar]

C:\TEMP>touch foo[baz]

C:\TEMP>perl -le "print for glob 'foo\\[*\\]'"
foo[bar]
foo[baz]

Yeah, as you will see from my second post, the critical thing seems to
be the presence of an escaped space as well. Thanks.


DS
.



Relevant Pages

  • Re: Any fannish happenings in London this weekend?
    ... I do not know what you mean by "inexpensive" but I will recommend the ... The Crescent Hotel. ... a fan and I stayed there after being in Glasgow for the 2005 Worldcon. ...
    (rec.arts.sf.fandom)
  • Re: Plug for Allelectronics
    ... I am a big fan of that place. ... A search will find I recommend them on ... this forum. ... I have been a customer for decades, ...
    (rec.games.pinball)
  • Re: Best Compact Fluorescents
    ... in ceiling fans. ... The incandescents do generate a lot of heat. ... I don't know why GE would recommend against CFL's in a ceiling fan, ...
    (sci.engr.lighting)
  • Re: Nottingham Parking Ticket Fiasco
    ... Traffic wardens are told to give 5-10 mins grace for overstayers, ACPO ... recommend a speeding margin, etc. ... I'm a great fan of striving for an ideal, but not so great a fan of ...
    (uk.legal)
  • Re: [glob -tails] broken in respect to tilde-filenames!
    ... I recommend not doing that;). ... > report the bug to. ... The last time this was reported it was decided it was not a bug. ... must prepend './' when trying to pass the return values of 'glob' to ...
    (comp.lang.tcl)