docs: update
This commit is contained in:
21
README.md
21
README.md
@@ -31,6 +31,8 @@ scripts and not full blown utilities.
|
|||||||
* [Strings](#strings)
|
* [Strings](#strings)
|
||||||
* [Get the directory name of a file path.](#get-the-directory-name-of-a-file-path)
|
* [Get the directory name of a file path.](#get-the-directory-name-of-a-file-path)
|
||||||
* [Trim quotes from a string.](#trim-quotes-from-a-string)
|
* [Trim quotes from a string.](#trim-quotes-from-a-string)
|
||||||
|
* [Arrays](#arrays)
|
||||||
|
* [Reverse an array.](#reverse-an-array)
|
||||||
* [Colors](#colors)
|
* [Colors](#colors)
|
||||||
* [Convert a hex color to RGB.](#convert-a-hex-color-to-rgb)
|
* [Convert a hex color to RGB.](#convert-a-hex-color-to-rgb)
|
||||||
* [Convert an RGB color to hex.](#convert-an-rgb-color-to-hex)
|
* [Convert an RGB color to hex.](#convert-an-rgb-color-to-hex)
|
||||||
@@ -110,6 +112,25 @@ trim_quotes() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Arrays
|
||||||
|
|
||||||
|
### Reverse an array.
|
||||||
|
|
||||||
|
Enabling `extdebug` allows access to the `BASH_ARGV` array which stores
|
||||||
|
the current function’s arguments in reverse.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
reverse_array() {
|
||||||
|
# Usage: reverse_array "array"
|
||||||
|
# reverse_array 1 2 3 4 5 6
|
||||||
|
shopt -s extdebug
|
||||||
|
f()(printf "%s " "${BASH_ARGV[@]}"); f "$@"
|
||||||
|
shopt -u extdebug
|
||||||
|
|
||||||
|
printf '\n'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Colors
|
## Colors
|
||||||
|
|
||||||
### Convert a hex color to RGB.
|
### Convert a hex color to RGB.
|
||||||
|
|||||||
Reference in New Issue
Block a user