Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ basename(C) — OpenDesktop 1.1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dirname(C)

sh(C)


     BASENAME(C)                          UNIX System V



     Name
          basename - removes directory names from pathnames


     Syntax
          basename string [ suffix ]


     Description
          basename deletes any prefix ending in / and the  suffix  (if
          present in string) from string, and prints the result on the
          standard output.  The result is the  ``base''  name  of  the
          file,  i.e.,  the  filename  without any preceding directory
          path  and  without  an  extension.   It   is   used   inside
          substitution marks (``) in shell procedures to construct new
          filenames.

          The related command dirname  deletes  the  last  level  from
          string and prints the resulting path on the standard output.


     Examples
          The following command displays the  filename  memos  on  the
          standard output:

               basename /usr/johnh/memos.old .old

          The  following  shell  procedure,  when  invoked  with   the
          argument  /usr/src/cmd/cat.c,  compiles  the  named file and
          moves the  output  to  a  file  named  cat  in  the  current
          directory:

               cc $1
               mv a.out `basename $1 .c`


     See Also
          dirname(C), sh(C)


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


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




































































































































































































































































































































































































































































































































































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