mirror of
https://github.com/dylanaraps/pure-sh-bible
synced 2024-05-18 05:16:40 +02:00
LICENSE.md | ||
README.md |
pure sh bible
A collection of pure POSIX sh
alternatives to external processes
Table of Contents
STRINGS
Strip pattern from start of string
Example Function:
lstrip() {
# Usage: lstrip "string" "pattern"
printf '%s\n' "${1##$2}"
}
Example Usage:
$ lstrip "The Quick Brown Fox" "The "
Quick Brown Fox
Strip pattern from end of string
Example Function:
rstrip() {
# Usage: rstrip "string" "pattern"
printf '%s\n' "${1%%$2}"
}
Example Usage:
$ rstrip "The Quick Brown Fox" " Fox"
The Quick Brown