Skip to content

Instantly share code, notes, and snippets.

@NewAlexandria
Created August 14, 2013 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NewAlexandria/6236408 to your computer and use it in GitHub Desktop.
Save NewAlexandria/6236408 to your computer and use it in GitHub Desktop.
A file that reads from and writes to itself
#!/usr/bin/ruby
lines = IO.readlines($0) << (DATA.readlines << ARGV[0])
File.open($0, 'w') { |file| file.puts lines }
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment