basename.1 (1115B)
- .\" utils-std: Collection of commonly available Unix tools
- .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- .\" SPDX-License-Identifier: MPL-2.0
- .Dd 2024-07-28
- .Dt BASENAME 1
- .Os
- .Sh NAME
- .Nm basename
- .Nd print last path component of a path
- .Sh SYNOPSIS
- .Nm
- .Op Fl z
- .Op Ar path
- .Op Ar suffix
- .Nm
- .Op Fl az
- .Op Fl s Ar suffix
- .Op Ar path...
- .Sh DESCRIPTION
- .Nm
- prints the last path component of
- .Ar path
- with removing any trailing slashes as well as trailing
- .Ar suffix
- when applicable.
- .Pp
- When
- .Ar path
- isn't given or is an empty string
- .Dq \&.
- is printed.
- .Sh OPTIONS
- .Bl -tag -width _s_suffix
- .It Fl a
- Support multiple
- .Ar path
- arguments
- .It Fl s Ar suffix
- Set
- .Ar suffix ;
- implies
- .Fl a
- .It Fl z
- Use NULL as separator for each result instead of newline.
- .El
- .Sh EXIT STATUS
- .Ex -std
- .Sh SEE ALSO
- .Xr dirname 1 ,
- .Xr basename 3
- .Sh STANDARDS
- .Nm
- should be compliant with the
- IEEE Std 1003.1-2024 (“POSIX.1”)
- specification.
- .Pp
- The
- .Fl a ,
- .Fl s
- and
- .Fl z
- options are extensions inspired by GNU coreutils.
- .Sh AUTHORS
- .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me