MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //proc/2/root/usr/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%/*}"
}