linux命令basename使用方法

 

如何从文件名中去掉路径和扩展名,linux里面提供了basename命令实现这个功能
例:basename fx-margin/usa-vps .h
Output “usa-vps”.

Usage: basename NAME [SUFFIX]
or: basename OPTION
Print NAME with any leading directory components removed.
If specified, also remove a trailing SUFFIX.

–help display this help and exit 显示帮助信息
–version output version information and exit 显示

Examples: 例子
basename /usr/bin/sort Output “sort”.
basename include/stdio.h .h Output “stdio”.

想在网络上拥有自己的linux吗,参考:用burst vps构建网站教程