linux常用命令(十六)
1、basename命令用于去掉文件名的目录和后缀[root@shell tomcat]# basename /home/data/tomcat/1.txt1.txt

2、截取[root@shell tomcat]# basename a_b_c_d_finished.jpg finished.jpga_b_c_d_

3、dirname返回截取path中的目录路径[root@shell tomcat]# dirname /home/data/tomcat/1.txt/home/data/tomcat

4、获取当前脚本的绝对路径[root@shell tomcat]# cat 1.txt#!/bin/bashPATH=$(dirname $0)echo $PATH

5、执行脚本,可以获取执行脚本的绝对路径[root@shell tomcat]# sh /home/data/tomcat/1.txt/home/data/tomcat

6、[root@shell tomcat]# dirname /etc/sysconfig/network-scripts/ifc熠硒勘唏fg-eth0/etc/sysconfig/network-scripts
