Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.52 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. #random_sig.rb
  3.  
  4. filename = ARGV[0] || (ENV['HOME'] + '/bin/sig_quotes.txt')
  5. quotation_file = File.new(filename, 'r')
  6. file_lines = quotation_file.readlines()
  7. quotation_file.close()
  8. quotations = file_lines.to_s.split("\n\n")
  9. random_index = rand(quotations.size)
  10. quotation = quotations[random_index]
  11. sig_file_name = ENV['HOME'] + '/.signature'
  12. signature_file = File.new(sig_file_name, 'w')
  13. signature_file.puts 'Matthew Grant Crisp | matthewgcrisp.com'
  14. signature_file.puts quotation
  15. signature_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement