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
Commands