Open lunik1 opened 2 years ago
Fixed:
basename() {
# Usage: basename "path" ["suffix"]
local tmp
case "${1:-''}" in '') return 1;; esac
tmp=${1%"${1##*[!/]}"}
tmp=${tmp##*/}
case "${2:-''}" in '') :;; *) tmp=${tmp%"${2/"$tmp"}"};; esac
printf '%s\n' "${tmp:-/}"
}
As the second argument can be unbound in
basename
, the following script will fail:with