Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- #random_sig.rb
- filename = ARGV[0] || (ENV['HOME'] + '/bin/sig_quotes.txt')
- quotation_file = File.new(filename, 'r')
- file_lines = quotation_file.readlines()
- quotation_file.close()
- quotations = file_lines.to_s.split("\n\n")
- random_index = rand(quotations.size)
- quotation = quotations[random_index]
- sig_file_name = ENV['HOME'] + '/.signature'
- signature_file = File.new(sig_file_name, 'w')
- signature_file.puts 'Matthew Grant Crisp | matthewgcrisp.com'
- signature_file.puts quotation
- signature_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement