docs: update
This commit is contained in:
@@ -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:-/}"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user