mirror of
https://github.com/dylanaraps/pure-sh-bible
synced 2024-05-17 21:06:36 +02:00
bible: fix dirname
This commit is contained in:
parent
30dad5e2f5
commit
6c179f7f03
|
@ -487,11 +487,8 @@ dirname() {
|
||||||
# Usage: dirname "path"
|
# Usage: dirname "path"
|
||||||
dir=${1%%/}
|
dir=${1%%/}
|
||||||
|
|
||||||
# If there are no '/' in the path, use '.'.
|
[ "$dir" ] || dir=//
|
||||||
case $dir in
|
[ "${dir##*/*}" ] && dir=.
|
||||||
*/*) ;;
|
|
||||||
*) dir=.
|
|
||||||
esac
|
|
||||||
|
|
||||||
printf '%s\n' "${dir%/*}"
|
printf '%s\n' "${dir%/*}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue