为什么这会给我一个错误?数是

时间:2016-01-17 17:07:30

标签: shell

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

我真的不明白为什么不工作......

1 个答案:

答案 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和' [' ,脚本将起作用。