basename(1) MPE/iX Shell and Utilities basename(1)
______________________________________________________________________
NAME
basename -- display file name component of path name
SYNOPSIS
basename name [suffix]
DESCRIPTION
basename strips off the leading part of a path name, leaving only
the final component of the name, which is assumed to be the file
name. To accomplish this, basename first checks to see if name
consists of nothing but slash (/) characters. If so, basename
replaces name with a single slash and the process is complete. If
not, basename proceeds to remove any trailing slashes. If slashes
still remain, basename strips off all leading characters up to
and including the final slash. Finally, if you specify suffix
and the remaining portion of name contains a suffix which matches
suffix, then basename removes that suffix.
EXAMPLES
The command
basename src/dos/printf.c .c
produces
printf
DIAGNOSTICS
Possible exit status values are:
0 Successful completion.
1 Failure due to any of the following:
-- unknown command line option
-- incorrect number of arguments
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems.
MPE/iX NOTES
On MPE/iX, basename is available as both a built-in shell utility
and an external utility.
SEE ALSO
dirname(1)
1