1. Function description
BaseName
Prints "name" after removing the leading directory path part from the file name path.
If you specify a suffix, the trailing "suffix" is also removed.
2. Usage
basename path name [suffix]
basename options
3. Options
--HELP Display this help message and exit
--version display version information and exit
4. Example
Default only removes path print file name and suffix
#basename/root/install.log.syslog
Install.log.syslog
Specifying a suffix (. syslog) removes the specified suffix from printing
# Basename/root/install.log.syslog. syslog
Install.log
In fact, we can see the result, the part of the specified file name will remove the specified part of the print file name.
# Basename/root/install.log.syslog. Log.syslog
Install
Basename/root/install.log.syslog Stall.log.syslog
Inch
This article from "Gen Y Little Rookie" blog, declined reprint!
Linux Command Summary basename