[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`
   if [ -f $file ]; then
     cp $file ./temp$i.gif
     if [ $? -ne 0 ]; then
        echo "copy file failed"
 i = 'expr $i+1'

Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!

Reply to: