docs: update

This commit is contained in:
Dylan Araps 2019-09-19 21:00:15 +03:00
parent 3590d9b03a
commit bb88623af1
2 changed files with 12 additions and 8 deletions

View File

@ -1101,11 +1101,13 @@ Alternative to the `basename` command.
```sh ```sh
basename() { basename() {
# Usage: basename "path" ["suffix"] # Usage: basename "path" ["suffix"]
dir=${1%${1##*[!/]}} local tmp
dir=${dir##*/}
dir=${dir%"$2"}
printf '%s\n' "${dir:-/}" tmp=${1%${1##*[!/]}}
tmp=${tmp##*/}
tmp=${tmp%"${2/$1}"}
printf '%s\n' "${tmp:-/}"
} }
``` ```

View File

@ -40,11 +40,13 @@ Alternative to the `basename` command.
```sh ```sh
basename() { basename() {
# Usage: basename "path" ["suffix"] # Usage: basename "path" ["suffix"]
dir=${1%${1##*[!/]}} local tmp
dir=${dir##*/}
dir=${dir%"$2"}
printf '%s\n' "${dir:-/}" tmp=${1%${1##*[!/]}}
tmp=${tmp##*/}
tmp=${tmp%"${2/$1}"}
printf '%s\n' "${tmp:-/}"
} }
``` ```