mirror of
https://github.com/dylanaraps/pure-sh-bible
synced 2024-05-22 07:16:35 +02:00
docs: update
This commit is contained in:
parent
b3c4069867
commit
397c518833
43
README.md
43
README.md
|
@ -7,4 +7,47 @@ A collection of pure POSIX `sh` alternatives to external processes
|
|||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
* [STRINGS](#strings)
|
||||
* [Strip pattern from start of string](#strip-pattern-from-start-of-string)
|
||||
* [Strip pattern from end of string](#strip-pattern-from-end-of-string)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
|
||||
# STRINGS
|
||||
|
||||
## Strip pattern from start of string
|
||||
|
||||
**Example Function:**
|
||||
|
||||
```sh
|
||||
lstrip() {
|
||||
# Usage: lstrip "string" "pattern"
|
||||
printf '%s\n' "${1##$2}"
|
||||
}
|
||||
```
|
||||
|
||||
**Example Usage:**
|
||||
|
||||
```shell
|
||||
$ lstrip "The Quick Brown Fox" "The "
|
||||
Quick Brown Fox
|
||||
```
|
||||
|
||||
## Strip pattern from end of string
|
||||
|
||||
**Example Function:**
|
||||
|
||||
```sh
|
||||
rstrip() {
|
||||
# Usage: rstrip "string" "pattern"
|
||||
printf '%s\n' "${1%%$2}"
|
||||
}
|
||||
```
|
||||
|
||||
**Example Usage:**
|
||||
|
||||
```shell
|
||||
$ rstrip "The Quick Brown Fox" " Fox"
|
||||
The Quick Brown
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue