Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dirname(1)

ex(1)

sh(1)

basename(1)

NAME

basename − strip directory names from pathname

SYNTAX

basename string [suffix]

DESCRIPTION

The basename command deletes from string any prefix ending in a slash (/) and the suffix, and prints the result on the standard output.  The basename command also handles limited regular expressions in the manner as ex(.). The basename command is often used inside substitution marks (` `) within shell procedures.

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

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

SEE ALSO

dirname(1), ex(1), sh(1)

Commands

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