The Autopackage API

Table of Contents / Public library / String utility functions

String utility functions

String manipulation, version matching, etc.

Functions in this category

versionFromRootNameRootName
getMajorVersion
matchVersionList<VERSION> [VERSION] [...]
escapeFilename<FILENAME>


Details

versionFromRootName
Syntax: versionFromRootName RootName
Extract the version number from a root name.
RootName: A root name.
Outputs: The root name's version number.
Example:
versionFromRootName "@foo.bar/foobar/2.2"    # =>  2.2


getMajor
Syntax: getMajor Version
Extract the major version from a version number.
Version: A version number.
Outputs: The major version number.
Example:
getMajor 2.3.4pre      # =>  2


matchVersionList
Syntax: matchVersionList <VERSION> [VERSION] [...]
Given a list of versions, will ensure that at least one of them is >= the first version given.
Example:
matchVersionList 2.4 1.8 2.0.3 2.5.3   # =>  0


escapeFilename
Syntax: escapeFilename <FILENAME>
Escape quotes and other special characters in a filename.
FILENAME: A filename.
Outputs: The escaped filename.
Example:
# We want a file called: "The $cript's World\".txt
fn=`escapeFilename "\"The \$cript's World\\\".txt"`
eval "touch $fn"      # touch touch \"The\ \$cript\'s\ World\\\".txt


Last update: 27/3/2003