At 02:01 08.03.01 +0900, Urban Hafner wrote:
>It helped but there are several other problems:
>1. If I run the program, I want to get only those Files that are valid
>   Ruby code, but there are some files that contain nothing. What did
>   I forget?

1) Ruby processes fast enough so that sometimes you write two files
   with the same content.
   Better: Use the timestamp from the beginning of the
   program as infix and concat the loop run number.
  
2) If you run your program below, there are cases where the changed program
   can be run, too. As you run it with "ruby", it will actually be executed
   and lead to additional files!
   You should add the parameter -c so that ruby only parses the file.   

>
infix = Time.now.to_f.to_s
1.upto(20) do |suffix|
  get = File.new($0,"r")
  child = "#{$0 + infix + suffix.to_s}.rb"
>  put = File.new(child,"w")
> [...]
>  put.close
   unless system("ruby", "-c", "#{child}")
>      File.delete("#{child}")
>  end
>end
>


-
Tammo Freese
freese / acm.org