Skip to content
Snippets Groups Projects
Commit f01b6712 authored by Richard Hartmann's avatar Richard Hartmann
Browse files

Improve basename()

parent 27a39552
Branches
Tags
No related merge requests found
......@@ -13,9 +13,11 @@
# this software will most likely follow suit.
basename() {
local f; f="${1##*/}"
[ -z "$2" ] || f="${f%$2}"
echo "$f"
# Implemented in shell to avoid spawning another process
local file
file="${1##*/}"
[ -z "$2" ] || file="${file%$2}"
echo "$file"
}
SELF=$(basename $0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment