aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2019-09-19 20:04:04 +0300
committerDylan Araps <dylan.araps@gmail.com>2019-09-19 20:04:04 +0300
commitea1864fd09a2fd992bc4f7793f44289b87d63621 (patch)
treec4fa6f4c48f7fedad26ff4ba326565bdfcaf8298
parent9e6185bb3ae96c4b7a4345b0bd31cb10659a9028 (diff)
downloadpure-sh-bible-ea1864fd09a2fd992bc4f7793f44289b87d63621.tar.gz
pure-sh-bible-ea1864fd09a2fd992bc4f7793f44289b87d63621.zip
docs: update
-rw-r--r--README.md7
1 files changed, 5 insertions, 2 deletions
diff --git a/README.md b/README.md
index ec7285b..638e4d5 100644
--- a/README.md
+++ b/README.md
@@ -512,8 +512,11 @@ Alternative to the `basename` command.
```sh
basename() {
# Usage: basename "path"
- path=${1%/}
- printf '%s\n' "${path##*/}"
+ dir=${1%${1##*[!/]}}
+ dir=${dir##*/}
+ dir=${dir%"$2"}
+
+ printf '%s\n' "${dir:-/}"
}
```