logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

basename.1 (1115B)


  1. .\" utils-std: Collection of commonly available Unix tools
  2. .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. .\" SPDX-License-Identifier: MPL-2.0
  4. .Dd 2024-07-28
  5. .Dt BASENAME 1
  6. .Os
  7. .Sh NAME
  8. .Nm basename
  9. .Nd print last path component of a path
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Op Fl z
  13. .Op Ar path
  14. .Op Ar suffix
  15. .Nm
  16. .Op Fl az
  17. .Op Fl s Ar suffix
  18. .Op Ar path...
  19. .Sh DESCRIPTION
  20. .Nm
  21. prints the last path component of
  22. .Ar path
  23. with removing any trailing slashes as well as trailing
  24. .Ar suffix
  25. when applicable.
  26. .Pp
  27. When
  28. .Ar path
  29. isn't given or is an empty string
  30. .Dq \&.
  31. is printed.
  32. .Sh OPTIONS
  33. .Bl -tag -width _s_suffix
  34. .It Fl a
  35. Support multiple
  36. .Ar path
  37. arguments
  38. .It Fl s Ar suffix
  39. Set
  40. .Ar suffix ;
  41. implies
  42. .Fl a
  43. .It Fl z
  44. Use NULL as separator for each result instead of newline.
  45. .El
  46. .Sh EXIT STATUS
  47. .Ex -std
  48. .Sh SEE ALSO
  49. .Xr dirname 1 ,
  50. .Xr basename 3
  51. .Sh STANDARDS
  52. .Nm
  53. should be compliant with the
  54. IEEE Std 1003.1-2024 (“POSIX.1”)
  55. specification.
  56. .Pp
  57. The
  58. .Fl a ,
  59. .Fl s
  60. and
  61. .Fl z
  62. options are extensions inspired by GNU coreutils.
  63. .Sh AUTHORS
  64. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me