NAME
bk glob − demo program to show glob pattern
expansion
SYNOPSIS
bk glob pattern string [string string
...]
DESCRIPTION
Some BitKeeper interfaces use what are called “glob
patterns,” sometimes known as wild cards. Examples
include the configuration file, history listing (bk
changes), and file name expansion (bk files).
This command may be used to match a glob against one or more strings to see examples of how the pattern matching works.
WILDCARD
MATCHING
A string is a glob pattern if it contains one of the
characters “*”, “?”,
“[”, or sometimes “=”. (The last
one, “=”, is an alias for “*”, to
avoid shell quoting in many cases. See
CONFIGURATION below.) The glob pattern is
used to match one or more strings (or file names), usually
in a process that takes a glob pattern and a list of
possible matches and returns the subset of the list which
matches the glob pattern. Matching works as follows:
? Matches any single character (unless “?”
is between brackets).
* Matches any string (unless “*” is between
brackets).
[...] A set of characters enclosed in brackets
matches a single character if and only if the character is
in the set.
[ˆ...] As above but inverts the set. In
other words “[ˆabc]” matches any character
except “a”, “b”, or
“c”.
CONFIGURATION
It is possible to disable all use of globs in file name
expansion by setting the environment variable
BK_NO_FILE_GLOB to any value.
Since aliasing “=” for “*” is not a standard feature and it may cause problems when processing files with “=” as part of their name, it must be explicitly enabled by setting BK_GLOB_EQUAL to the value of YES. No other value will enable this feature.
EXAMPLES
Test a simple pattern match that matches file.c and
file.h:
bk glob ’*.[ch]’ file.c file.h file.1
List all files ending in “.1”:
export
BK_GLOB_EQUAL=YES
bk -A files =.1
See changes in all header files in the current directory:
bk diff ’*.h’
See the revision history for all C/header files with the phrase “sccs” in their name:
bk sccslog ’*sccs*.[ch]’
See all changesets which include the phrase “BUGID:” followed by a number:
bk changes ’-/BUGID:[123456789]/’
BUGS
Sets of characters, i.e., [A-Z], have only marginal support.
Escaping the minus in the set is not supported.
SEE ALSO
bk-config-etc, bk-changes, bk-files
CATEGORY
File
Repository