cat create.sh
#!/bin/bash
for i in 1 2 3 4 5 6 7 8 9 10
do
dd if=/dev/zero of=file"$i".txt count="$i"
done
[root@squid1 test]# cat rename.sh
#!/bin/bash
ls -lSr file* | awk '{print $9}' > temp.txt
j=1
for i in `cat temp.txt`
do mv $i $j
j=`expr 1 + $j`
done
exit 0
#C-style
[root@squid1 test]# cat for.sh
#!/bin/bash
for ((i=1;i<=10;i++))
do
echo "$i"
done
exit 0
文章出处:
阅读(1165) | 评论(0) | 转发(0) |