mirror of
https://github.com/dylanaraps/pure-bash-bible.git
synced 2025-09-03 12:22:49 +02:00
docs: update
This commit is contained in:
10
README.md
10
README.md
@@ -1101,11 +1101,13 @@ Alternative to the `basename` command.
|
||||
```sh
|
||||
basename() {
|
||||
# Usage: basename "path" ["suffix"]
|
||||
dir=${1%${1##*[!/]}}
|
||||
dir=${dir##*/}
|
||||
dir=${dir%"$2"}
|
||||
local tmp
|
||||
|
||||
printf '%s\n' "${dir:-/}"
|
||||
tmp=${1%${1##*[!/]}}
|
||||
tmp=${tmp##*/}
|
||||
tmp=${tmp%"${2/$1}"}
|
||||
|
||||
printf '%s\n' "${tmp:-/}"
|
||||
}
|
||||
```
|
||||
|
||||
|
@@ -40,11 +40,13 @@ Alternative to the `basename` command.
|
||||
```sh
|
||||
basename() {
|
||||
# Usage: basename "path" ["suffix"]
|
||||
dir=${1%${1##*[!/]}}
|
||||
dir=${dir##*/}
|
||||
dir=${dir%"$2"}
|
||||
local tmp
|
||||
|
||||
printf '%s\n' "${dir:-/}"
|
||||
tmp=${1%${1##*[!/]}}
|
||||
tmp=${tmp##*/}
|
||||
tmp=${tmp%"${2/$1}"}
|
||||
|
||||
printf '%s\n' "${tmp:-/}"
|
||||
}
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user