docs: update
This commit is contained in:
10
README.md
10
README.md
@@ -485,7 +485,15 @@ Alternative to the `dirname` command.
|
|||||||
```sh
|
```sh
|
||||||
dirname() {
|
dirname() {
|
||||||
# Usage: dirname "path"
|
# Usage: dirname "path"
|
||||||
printf '%s\n' "${1%/*}/"
|
dir=${1%%/}
|
||||||
|
|
||||||
|
# If there are no '/' in the path, use '.'.
|
||||||
|
case $dir in
|
||||||
|
*/*) ;;
|
||||||
|
*) dir=.
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf '%s\n' "${dir%/*}"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user