1
# Date: Fri, 11 Oct 91 11:22:36 edt
2
# From: friedman@gnu.ai.mit.edu
3
# To: bfox@gnu.ai.mit.edu
5
# A replacement for basename(1). Not all the systems I use have this
6
# program. Usage: basename [path] {extension}
11
local tpath="${path%/}"
13
# Strip trailing '/' characters from path (unusual that this should
14
# ever occur, but basename(1) seems to deal with it.)
15
while [ "${tpath}" != "${path}" ]; do
20
path="${path##*/}" # Strip off pathname
21
echo ${path%${suffix}} # Also strip off extension, if any.