Next: , Previous: , Up: Package Functions   [Contents][Index]

7.7.7 ‘pkg_find()

pkg_find()’ is the tool for searching packages. It accepts up to 3 arguments.

$1: Query

This is the only mandatory argument. It accepts globbing, meaning that shell wildcards can be used in the query.

$2: Match

If this exists ‘pkg_find()’ will print every single match found in the search path. If it doesn’t, ‘pkg_find()’ will print the first match and exit.

$3: Type

This is the argument to be passed to the ‘test’ function. Unless this argument is given, it defaults to ‘-d’, which tests for directories.

# Returns the first match of cpt
pkg_find cpt

# Returns all matches of cpt
pkg_find cpt all

# Returns all globbed matches for cpt* (e.g. cpt and cpt-extra)
pkg_find 'cpt*' all

# Returns all matching cpt-* executables on user's PATH
SEARCH_PATH=$PATH pkg_find 'cpt-*' all -x