mirror of
https://github.com/dylanaraps/pure-sh-bible
synced 2024-06-18 13:35:18 +02:00
docs: update
This commit is contained in:
parent
5254f30e8d
commit
30dad5e2f5
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%/*}"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue