docs: update

This commit is contained in:
Dylan Araps 2019-09-19 16:35:35 +03:00
parent 5254f30e8d
commit 30dad5e2f5

View file

@ -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%/*}"
} }
``` ```