Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dirname(C) — OpenDesktop 1.1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

basename(C)

sh(C)


     DIRNAME(C)                           UNIX System V



     Name
          dirname - delivers directory part of pathname


     Syntax
          dirname string


     Description
          dirname delivers all but the last component of the  pathname
          in  string and prints the result on the standard output.  If
          there is only one component in the pathname, only a  ``dot''
          is  printed.   It is normally used inside substitution marks
          (``) within shell procedures.

          The companion command basename deletes any prefix ending  in
          a  slash  (/)  and  the  suffix  (if present in string) from
          string, and prints the result on the standard output.


     Examples
          The following  example  sets  the  shell  variable  NAME  to
          /usr/src/cmd:

               NAME=`dirname /usr/src/cmd/cat.c`

          This example prints /a/b/c on the standard output:

               dirname /a/b/c/d

          This example prints a ``dot'' on the standard output:

               dirname file.ext

          This example moves to the location of a file being  searched
          for (lostfile):

               cd `find . -name lostfile -exec dirname { } ;`


     See Also
          basename(C), sh(C)


     Standards Conformance
          dirname is conformant with:
          The X/Open Portability Guide II of January 1987.


     (printed 2/15/90)                                 DIRNAME(C)
































































































































































































































































































































































































































































































































































Typewritten Software • bear@typewritten.org • Edmonds, WA 98026