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

shell program help wanted!



Hi, there:
I don't think I am in the correct mailing list for this question, but I do need help, so if anyone can answer my question, please help me.
My question is I have lots of files with long name under one directory and I want to change the names of the file to temp0, temp1, temp2,...tempN, etc. so I wrote the following shell code, but it didn't work (actually, I don't know how to make the number at the file name temp?)


thanks in advances!

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


_________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at http://profiles.msn.com.





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