....Ruby example, from pixel@mandrakesoft.com Dir['**/*.c'].each{|c| o = c.sub('\.c$', '.o') if !FileTest.exist?(o) || File.stat(o) <= File.stat(c) then puts "compiling #{c} to #{o}" system("gcc", "-c", "-o", o, c) end }Ruby provides support for iteration (.each{|c|...}), pattern matching/replacement (c.sub(P1,P2)), system calls (system(Command,A1,A2,...)), recursive file filtering (Dir['**/*.c']), file property access (File.stat, FileTest).
LL2, Saturday 9 November 2002, Tim Hickey/Ken Anderson