Module glob

Module glob 

Source
Expand description

Pathname expansion

Pathname expansion (a.k.a. globbing) scans directories and produces pathnames matching the input field.

§Pattern syntax

An input field is split by /, and each component is parsed as a pattern that may contain the following non-literal elements:

  • ?
  • *
  • Bracket expression (a set of characters enclosed in brackets)
  • \

Refer to the yash-fnmatch crate for pattern syntax and semantics details.

§Directory scanning

The expansion scans directories corresponding to components containing any non-literal elements above. The scan requires read permission for the directory. For components that have only literal characters, no scan is performed. Search permissions for all ancestor directories are needed to check if the file exists referred to by the resulting pathname.

§Results

Pathname expansion returns pathnames that have matched the input pattern, sorted alphabetically. Any errors are silently ignored. If directory scanning produces no pathnames, the input pattern is returned intact. (TODO: the null-glob option)

If the input field contains no non-literal elements subject to pattern matching at all, the result is the input intact.

Structs§

Glob
Iterator that provides results of parameter expansion

Functions§

glob
Performs parameter expansion.