361aa1586fb1171f.jpg

basename返回一个字符串参数的基本文件名称
dirname命令去除文件名中的非目录部分,仅显示与目录有关的内容
[root@devops ~]# dirname /data/nginx/conf/nginx.conf
/data/nginx/conf
[root@devops ~]# basename /data/nginx/conf/nginx.conf
nginx.conf

[root@devops ~]# basename --help
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".

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code