config root man

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
Upload File :
Current File : //compat/linux/usr/share/doc/bash-3.2/functions/basename2

#From: "Grigoriy Strokin" <grg@philol.msu.ru>
#Newsgroups: comp.unix.shell
#Subject: fast basename and dirname functions for BASH/SH
#Date: Sat, 27 Dec 1997 21:18:40 +0300
#
#Please send your comments to grg@philol.msu.ru

function basename()
{
  local name="${1##*/}"
  echo "${name%$2}"
}

function dirname()
{
  local dir="${1%${1##*/}}"
  [ "${dir:=./}" != "/" ] && dir="${dir%?}"
  echo "$dir"
}

# Two additional functions:
# 1) namename prints the basename without extension
# 2) ext prints extension of a file, including "."

function namename()
{
  local name=${1##*/}
  local name0="${name%.*}"
  echo "${name0:-$name}"
}
function ext()
{
  local name=${1##*/}
  local name0="${name%.*}"
  local ext=${name0:+${name#$name0}}
  echo "${ext:-.}"
}







Man Man