ls>out
count="$(ls|wc -l)"
for i in {1..$count-2}
do
if[ "$(cat out|head -$count | tail -1)" != "rename.sh" ]; then
mv "$1$count$2" | cat out | head -$count | tail -1
fi
done
我真的不明白为什么不工作......
答案 0 :(得分:-1)
ls>out
count="$(ls|wc -l)"
for i in {1..$count-2}
do
if [ "$(cat out|head -$count | tail -1)" != "rename.sh" ]; then
mv "$1$count$2" | cat out | head -$count | tail -1
fi
done
在if和' [' ,脚本将起作用。