basename 535 B

1234567891011121314151617181920212223242526272829303132333435
  1. .TH BASENAME 1
  2. .SH NAME
  3. basename \- strip file name affixes
  4. .SH SYNOPSIS
  5. .B basename
  6. [
  7. .B -d
  8. ]
  9. .I string
  10. [
  11. .I suffix
  12. ]
  13. .SH DESCRIPTION
  14. .PP
  15. .I Basename
  16. deletes any prefix ending in slash
  17. .RB ( / )
  18. and the
  19. .IR suffix ,
  20. if present in
  21. .IR string ,
  22. from
  23. .IR string ,
  24. and prints the result on the standard output.
  25. .PP
  26. The
  27. .B -d
  28. option instead prints the directory component,
  29. that is,
  30. .I string
  31. up to but not including the final slash.
  32. If the string contains no slash,
  33. a period and newline are printed.
  34. .SH SOURCE
  35. .B /sys/src/cmd/basename.c