The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 03-19-2009
wabard wabard is offline
Registered User
  
 

Join Date: Mar 2009
Location: Adelaide, SA & Perth, WA - Australia
Posts: 25
Exclamation

Code:
#!/bin/sh

i=1

while(a=1)
do
     if test -e  "FILE."$i
     then
       let i+=1
     else
       break
     fi
done

cp -f FILE FILE.$i

Last edited by wabard; 03-19-2009 at 08:53 PM.. Reason: FIXED The cp command line argument to -f from -r (I typed the wrong option, r and f are close on the keyboard .. lol )