本文共 1236 字,大约阅读时间需要 4 分钟。
basename返回一个字符串参数的基本文件名称。
>[/home/service/hs/temp]$basename 1.txt.old1.txt.old>[/home/service/hs/temp]$basename /1/1.txt.old1.txt.old>[/home/service/hs/temp]$basename /home/home/ 1home>[/home/service/hs/temp]$basename /home/home1 1home>[/home/service/hs/temp]$basename /home/home1 1home>[/home/service/hs/temp]$basename /home/home1 2home1>[/home/service/hs/temp]$basename /home/home1 1 2 basename: too many argumentsTry `basename --help' for more information.>[/home/service/hs/temp]$basename /home/home1/123/ 312>[/home/service/hs/temp]$basename /home/home1/124/ 3124
目录下有同名的文件
1.c 1.o 1.x
用命令重名成
>[/home/service/hs/temp]$find . -name "1.[cox]" |xargs -i basename {}|xargs -t -i mv {} {}.bakmv 1.c 1.c.bakmv 1.o 1.o.bakmv 1.x 1.x.bak
转载地址:http://gfdq.baihongyu.com/