quick Tcl globbing question: excluding lib*.[0-9.]*.dylib

Andrew Moore slewsys at gmail.com
Sun Jun 17 13:30:15 UTC 2018


On Jun 15, 2018, at 1:39 PM, René J.V. Bertin <rjvbertin at gmail.com> wrote:
> Is there a way to write a single glob regexp that expands to all lib*.dylib EXCLUDING lib*.[0-9]*.dylib, lib*.[0-9]*.[0-9]*.dylib, etc?

Rather than file globs, how about regular expressions:

foreach f [glob -tails -dir /opt/local/lib *.dylib] {
  if {[regex {lib[^.]+\.dylib} $f match]} {
    puts $match
  }
}

Note also that a port may provide only a lib*.[0-9].dylib.  Once example is XviD.
-AM


More information about the macports-dev mailing list