MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/local/ssl/share/doc/bash-3.2/functions/dirname
# Date: Fri, 11 Oct 91 11:22:36 edt
# From: friedman@gnu.ai.mit.edu
# To: bfox@gnu.ai.mit.edu

# A replacement for dirname(1).  This one appears less often on some
# systems I use than basename(1), and I really depend on it for some
# things.  Usage: dirname [path]
function dirname ()
{
 local dir="$1"
 local tdir="${dir%/}"

    # Strip trailing '/' characters from dir (unusual that this should
    # ever occur, but dirname(1) seems to deal with it.)
    while [ "${tdir}" != "${dir}" ]; do
       tdir="${dir}"
       dir="${tdir%/}"
    done

    echo "${dir%/*}"
}