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 (/) or backslash (\) characters. If so, basename replaces name with a single slash and the process is complete. If not, basename removes 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, basename removes that suffix.
EXAMPLES
The command
basename src/dos/printf.c .c
produces
printf
DIAGNOSTICS
Possible exit status values are:
NOTE
basename is provided as both an external utility and a built-in MKS KornShell utility.
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 2000. Windows XP. Windows Server 2003. Windows Vista. Windows 7. Windows Server 2008. Windows 8. Windows Server 2012.
On Windows systems, basename strips all characters up to and including the final backslash or slash. On UNIX and POSIX-compliant systems, backslashes are valid file name characters and are not considered delimiters.
AVAILABILITY
MKS Toolkit for Power Users
MKS Toolkit for System Administrators
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
MKS Toolkit 9.5 Documentation Build 3.