shell rename

时间一长,shell脚本的书写都有一些忘了,呵呵,还好总算是写出来了.记住一点,shell是以字符为中心的.

这个是重命名的,主要是在文件名中加入一个序号

!/bin/sh

x=0 for i in ls do if [ -f $i ] then if [ $1!=$0 ] then x=$[$x + 1] name=P$x if [ -f $name ] then x=$[$x - 1] echo "the $name is exisited" else mv $i $name fi fi fi done

转载于:https://www.cnblogs.com/fengidri/archive/2012/03/17/2757481.html

你可能感兴趣的:(shell rename)