BASENAME(1plan9)

✨ NAME ✨

okay bestie, meet basename β€” she’s from the 1plan9 manual, section 1, and her whole entire job is strip file name affixes. that’s it. that’s the gig. no cap. πŸ’…

🌸 SYNOPSIS 🌸

basename [ -d ] string [ suffix ]

πŸ¦‹ DESCRIPTION πŸ¦‹

Basename deletes any prefix ending in slash (/) and the suffix, if present in string, from string, and prints the result on the standard output. main character behavior, honestly. chop the path bits, keep it moving. ✨

  • -d β€” instead prints the directory component, that is, string up to but not including the final slash. If the string contains no slash, a period and newline are printed.
lowkey important: when there’s no slash for -d to find, you get a period and a newline. that’s the whole output. periodt. 😭

πŸ”₯ SOURCE πŸ”₯

/src/cmd/basename.c


and that’s the page, bestie β€” filed under the 1plan9 manual, section 1, with the source chilling at /src/cmd/basename.c. no date drama on this one, just iconic timeless Unix utility energy. mwah πŸ’–

πŸ“¦ where this page comes from