Current Path : /compat/linux/usr/share/doc/bash-3.2/functions/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //compat/linux/usr/share/doc/bash-3.2/functions/basename |
# Date: Fri, 11 Oct 91 11:22:36 edt # From: friedman@gnu.ai.mit.edu # To: bfox@gnu.ai.mit.edu # A replacement for basename(1). Not all the systems I use have this # program. Usage: basename [path] {extension} function basename () { local path="$1" local suffix="$2" local tpath="${path%/}" # Strip trailing '/' characters from path (unusual that this should # ever occur, but basename(1) seems to deal with it.) while [ "${tpath}" != "${path}" ]; do tpath="${path}" path="${tpath%/}" done path="${path##*/}" # Strip off pathname echo ${path%${suffix}} # Also strip off extension, if any. }