Skip to content
EntityQ257654· pop 19· linked from 219 articles

basename is a shell command for extracting the last name of a file path.

Key facts

Software.name
basename
Software.programming language
C
Software.operating system
Unix, Unix-like, IBM i, Plan 9, Inferno
Software.platform
Cross-platform
Software.genre
Command
Software.license
coreutils: GPLv3+Plan 9: MIT License

via Wikipedia infobox

Described at

Provide a default value for the internationalization variables that are unset or null. (See XBD Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) If set to a non-empty string value, override the values of all the other internationalization variables. Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. [XSI) ] ![[Option Start]]( Determine the location of message catalogs for the processing of LC MESSAGES. ![[Option End]]( The definition of pathname specifies implementation-defined behavior for pathnames starting with two characters. Therefore, applications shall not arbitrarily add characters to the beginning of a pathname unless they can ensure that there are more or less than two or are prepared to deal with the implementation-defined consequences. The following shell script compiles /usr/src/cmd/cat.c and moves the output to a file named cat in the current directory when invoked with the argument /usr/src/cmd/cat or with the argument /usr/src/cmd/cat.c : The EXAMPLES section of the basename () function (see XSH basename ) includes a table showing examples of the results of processing several sample pathnames by the basename () and dirname () functions and by the basename and dirname utilities. This would not work for the early proposal versions of these utilities due to the way it specified handling of trailing characters. Since the definition of pathname specifies implementation-defined behavior for pathnames starting with two characters, this volume of POSIX.1-2017 specifies similar implementation-defined behavior for the basename and dirname utilities. The normative text is reworded to avoid use of the term "must" for application requirements.

Excerpt from a page describing this subject · 9,098 chars · not written by Vinony

Wikidata facts

Show 1 more fact
Sources (2)

via Wikidata · CC0

~1 min read

Article

5 sections
Contents
  • Use
  • Examples
  • See also
  • References
  • External links

basename is a shell command for extracting the last name of a file path.

The command was introduced in X/Open Portability Guidelines issue 2 of 1987. It was inherited into the first version of POSIX and the Single Unix Specification. It first appeared in 4.4BSD. The version in GNU Core Utilities was written by David MacKenzie. The command is available for Windows as part of the GnuWin32 project and UnxUtils and is in IBM i.

Connections

Categories