Trim whitespace (spaces and tabs) from a string left and right.
- $1: the name of the variable to trim.
- $1: The variable should be set with the value to trim.
- This variable is directly trimmed on.
- non-zero if string error
Substitute text in place.
- $1: variable name to substitute in.
- $2: text to substitute away.
- $3: text to insert in place.
- $4: global, set to "1" to substitute all occurrences.
Find the first index of sub string in string.
- $1: sub string to search for.
- $2: string to search in.
- $3: optional variable name to store index value to. -1 when sub string not found.
- 0: if sub string found, 1 otherwise.
Escape in place up the occurrences of quotes, dollar signs, parenthesis, etc.
It is optional which of ", $, (, ), <, >, | and & to escape.
- $1: Name of the variable to escape up, in place.
-
$2: Optional which characters to escape, defaults to '"$ '.
Helper function.
- $1: name of variable to escape
- $2: character to escape.
Count all items in a string, split on current IFS.
- $1: string to count items in.
- $2: variable name to store count in
Get an item in a string by it's index,
where string is split on the current IFS.
- $1: string to get item from.
- $2: index of item to get.
- $3: variable name to store item to.
Find the first index of item in string.
- $1: string to lookup item in.
- $2: string of item to find.
- $3: variable name to store item index in, -1 when not found.
- 0: if item found, 1 otherwise.