O'Reilly logo

Practical Programming in Tcl & Tk, Third Edition by Brent B. Welch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Matching File Names with glob

The glob command expands a pattern into the set of matching file names. The general form of the glob command is:

glob ?flags? pattern ?pattern? ...

The pattern syntax is similar to the string match patterns:

  • * matches zero or more characters.

  • ? matches a single character.

  • [abc] matches a set of characters.

  • {a,b,c} matches any of a, b, or c.

  • All other characters must match themselves.

The -nocomplain flag causes glob to return an empty list if no files match the pattern. Otherwise, glob raises an error if no files match.

The -- flag must be used if the pattern begins with a -.

Unlike the glob matching in csh, the Tcl glob command matches only the names of existing files. In csh, the {a,b} construct can match nonexistent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required