docs: update

This commit is contained in:
Dylan Araps
2019-09-19 20:04:04 +03:00
parent 9e6185bb3a
commit ea1864fd09

View File

@@ -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:-/}"
}
```