Http://blog.sina.com.cn/s/blog_9d074aae01013ctk.html
First, dirname directive
1. Function: Remove the file name from the given file name containing the absolute path (part of the non-directory) and return the remaining path (part of the directory)
2. Usage: dirname filename
For example, here are a few examples
(1) # Dirname/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts
(2) # dirname/boot/grub/grub.conf
/boot/grub
(3) # Dirname/etc/inittab
/etc
(4) # echo ' pwd ' && dirname modprobe.conf
/etc
.
(5) #echo ' pwd ' && dirname sysconfig/network-scripts/
/etc
Sysconfig
Linux System Management
Second, basename directive
1, Function: Remove the left part of the directory from the given file name containing the absolute path or remove the content of a suffix (part of the directory), then return the remainder (non-directory part)
2. Usage: basename filename [suffix]
For example, here are a few examples
(1) #basename/etc/sysconfig/network-scripts/ifcfg-eth0
Ifcfg-eth0
(2) #basename/boot/grub/grub.conf
Grub.conf
BT4 Hack Wireless Network
(3) #echo ' pwd ' && basename sysconfig/network-scripts/
/etc
Network-scripts
(4) # Basename/boot/grub/grub.conf.bak. bak
Grub.conf
(5) # Basename/boot/grub/grub.conf.bak. Conf.bak
Grub
Linux DirName, basename instructions