[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

shell program help wanted!



Hi, debians:
I have a question about the shell program. The problem
is I have lots of files with long file name under on
directory and I want to changes the names of the files
to temp0, temp1.gif,temp2.gif,.....tempN.gif,etc and I
wrote the following shell program, but it doesn't
work(actually, I don't know how to make the number at
tempN.gif), can anybody help me to figure the problem?
Thanks in advance!

set i=0
for file in `ls`
do
   if [ -f $file ]; then
     cp $file ./temp$i.gif
     if [ $? -ne 0 ]; then
        echo "copy file failed"
     fi
   fi
 i = 'expr $i+1'
done


__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/



Reply to: