请输入您要查询的百科知识:

 

词条 Basename
释义

  1. History

  2. Usage

  3. Examples

  4. See also

  5. References

  6. External links

{{lowercase}}{{Infobox Software
| name = basename
| logo =
| screenshot =
| screenshot size =
| caption =
| developer =
| released = {{Start date and age|1979|1}}
| latest release version =
| latest release date =
| operating system = Unix and Unix-like
| genre = Command
| license = GNU GPL v3
| website =
}}

basename is a standard computer program on Unix and Unix-like operating systems. When basename is given a pathname, it will delete any prefix up to the last slash ('/') character and return the result. basename is described in the Single UNIX Specification and is primarily used in shell scripts.

History

The version of basename bundled in GNU coreutils was written by David MacKenzie.[1]

Usage

The Single UNIX Specification specification for basename is.

string

A pathname

suffix

If specified, basename will also delete the suffix.

Examples

basename will retrieve the last name from a pathname ignoring any trailing slashes

$ basename /home/jsmith/base.wiki

base.wiki

$ basename /home/jsmith/

jsmith

$ basename /

/

basename can also be used to remove the end of the base name, but not the complete base name

$ basename /home/jsmith/base.wiki .wiki

base

$ basename /home/jsmith/base.wiki ki

base.wi

$ basename /home/jsmith/base.wiki base.wiki

base.wiki

See also

  • List of Unix commands
  • dirname
  • Path

References

1. ^https://linux.die.net/man/1/basename

External links

  • {{man|cu|basename|SUS|return non-directory portion of a pathname}}
  • {{man|1|basename|die.net}}
  • {{man|1|basename|OpenBSD}}
{{Unix commands}}

2 : Standard Unix programs|Unix SUS2008 utilities

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/11 7:35:26