shell中%/*和#/*的区别
[root@yangdong tmp]# ls 1 2 ks-script-JdCfMP test.sh yum.log [root@yangdong tmp]# pwd /tmp [root@yangdong tmp]# ls 1 1.log [root@yangdong tmp]# ls 2 2.log [root@yangdong tmp]#
[root@yangdong tmp]# cat test.sh #!/bin/bash a=`find /tmp -name "*.log"` for i in $a;do echo ${i%/*} echo ${i#*/} done [root@yangdong tmp]# bash test.sh /tmp tmp/yum.log /tmp/1 tmp/1/1.log /tmp/2 tmp/2/2.log