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 ```sh
basename() { basename() {
# Usage: basename "path" # Usage: basename "path"
path=${1%/} dir=${1%${1##*[!/]}}
printf '%s\n' "${path##*/}" dir=${dir##*/}
dir=${dir%"$2"}
printf '%s\n' "${dir:-/}"
} }
``` ```