开源文档分享

BASENAME

Section: 用户命令 (1)
Updated: 2022年9月
查看本页索引 返回目录
 

名称

basename - 去除文件名中的目录与后缀  

概述

basename ,名称 /[,后缀/]
basename ,选项/... ,名称/...  

描述

打印已经移除所有目录相关信息后的(文件)名称。若特别指定,则同时移除指定的后缀名。

必选参数对长短选项同时适用。

-a, --multiple
支持多个参数,把每个参数看作一个(文件)名称来处理。
-s, --suffix=,后缀/
移除后缀;同时隐含 -a
-z, --zero
使每行输出以 NUL 字符结束,不添加换行符
--help
显示此帮助信息并退出
--version
显示版本信息并退出
 

范例

basename /usr/bin/sort
-> "sort"
basename include/stdio.h .h
-> "stdio"
basename -s .h include/stdio.h
-> "stdio"
basename -a any/str1 any/str2
-> "str1" 后接 "str2"
 

作者

由 David MacKenzie 编写。  

报告错误

GNU coreutils 的在线帮助: <https://www.gnu.org/software/coreutils/>
请向 <https://translationproject.org/team/zh_CN.html> 报告翻译错误。  

版权

Copyright © 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.  

参见

dirname(1), readlink(1)


完整文档请见: <https://www.gnu.org/software/coreutils/basename>
或者在本地使用: info '(coreutils) basename invocation'  


本页面中文版由中文 man 手册页计划提供。
中文 man 手册页计划:https://github.com/man-pages-zh/manpages-zh


 

Index

名称
概述
描述
范例
作者
报告错误
版权
参见

This document was created by man2html, using the manual pages.
Time: 03:15:39 GMT, July 01, 2024