Source Compatibility Guide

basename

Strips the full path name off a file. If you follow the path name with a suffix, that suffix is stripped, too:

$ basename /usr/src/rundog.c .c
rundog
$ 

basename is useful for writing shell scripts. This version parses arguments differently than the SunOS 5.x version.