public
Created

A file that reads from and writes to itself

  • Download Gist
selfie.rb
Ruby
1 2 3 4 5 6
#!/usr/bin/ruby
 
lines = IO.readlines($0) << (DATA.readlines << ARGV[0])
File.open($0, 'w') { |file| file.puts lines }
 
__END__

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.