basename name [suffix]
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.
basename src/dos/printf.c .c
Possible exit status values are:
Failure due to any of the following:
basename is provided as both an external utility and a built-in MKS KornShell utility.
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows Server 2012. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019.
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.
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.3 Documentation Build 39.