The Autopackage API |
Table of Contents / Public library / String utility functions |
String manipulation, version matching, etc.
versionFromRootName | RootName |
getMajor | Version |
matchVersionList | <VERSION> [VERSION] [...] |
escapeFilename | <FILENAME> |
versionFromRootName | ||||
Syntax: versionFromRootName RootName | ||||
Extract the version number from a root name. | ||||
| ||||
Example:versionFromRootName "@foo.bar/foobar/2.2" # => 2.2 |
getMajor | ||||
Syntax: getMajor Version | ||||
Extract the major version from a 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. | ||||
| ||||
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 |