mirror of
https://github.com/dylanaraps/pure-bash-bible.git
synced 2025-09-09 22:51:16 +02:00
docs: update
This commit is contained in:
16
README.md
16
README.md
@@ -31,6 +31,7 @@ scripts and not full blown utilities.
|
||||
* [Get the last N lines of a file.](#get-the-last-n-lines-of-a-file)
|
||||
* [Get the number of lines in a file.](#get-the-number-of-lines-in-a-file)
|
||||
* [Strings](#strings)
|
||||
* [Trim white-space from string.](#trim-white-space-from-string)
|
||||
* [Split a string on a delimiter.](#split-a-string-on-a-delimiter)
|
||||
* [Change a string to lowercase.](#change-a-string-to-lowercase)
|
||||
* [Change a string to uppercase.](#change-a-string-to-uppercase)
|
||||
@@ -117,6 +118,21 @@ lines() {
|
||||
## Strings
|
||||
|
||||
|
||||
### Trim white-space from string.
|
||||
|
||||
**NOTE**: This also truncates multiple spaces inside the string.
|
||||
|
||||
```sh
|
||||
# shellcheck disable=SC2086,SC2048
|
||||
trim() {
|
||||
# Usage: trim " example string "
|
||||
set -f
|
||||
set -- $*
|
||||
printf '%s\n' "$*"
|
||||
set +f
|
||||
}
|
||||
```
|
||||
|
||||
### Split a string on a delimiter.
|
||||
|
||||
```sh
|
||||
|
Reference in New Issue
Block a user