logo

utils-std

Collection of commonly available Unix tools
commit: 183d433adff0fae167a3c8cbc409ce127142c207
parent cf108b23959fd94a548382452d375743bce3d749
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 28 Jul 2024 12:04:50 +0200

cmd/basename: Using basename(3) should be fine

Diffstat:

Mcmd/basename.133++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/cmd/basename.1 b/cmd/basename.1 @@ -1,39 +1,38 @@ .\" utils-std: Collection of commonly available Unix tools .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me> .\" SPDX-License-Identifier: MPL-2.0 -.Dd 2021-04-05 +.Dd 2024-07-28 .Dt BASENAME 1 .Os .Sh NAME .Nm basename -.Nd return last path compoment of a pathname +.Nd print last path component of a path .Sh SYNOPSIS .Nm -.Op Ar string +.Op Ar path .Op Ar suffix .Sh DESCRIPTION -When -.Ar string -isn't given -.Dq \&. -is returned. -Otherwise it gives the last path compoment of -.Ar string -with removing the last part matching +.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 EXIT STATUS .Ex -std .Sh SEE ALSO +.Xr dirname 1 , .Xr basename 3 .Sh STANDARDS .Nm -is close but not compliant with the +should be compliant with the IEEE Std 1003.1-2024 (“POSIX.1”) -specification as it uses -.Xr basename 3 -directly instead of extracting the non-directory portion of -.Ar string -with it's own algorithm. +specification. .Sh AUTHORS .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me