Created
June 18, 2012 13:19
-
-
Save toche/2948332 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filename = ARGV.first | |
script = $0 | |
puts "We're going to erase #{filename}" | |
puts "If you dont want that, hit CTRL-C (^C)" | |
puts "If you do want that, hit RETURN" | |
print "?" | |
STDIN.gets | |
puts "Opening the file.." | |
target ? file.open(filename, 'w') | |
puts "Truncating the file. See ya!" | |
target.truncate(target.size) | |
print "Line 1: "; line1 = STDIN.gets.chomp() | |
print "Line 2: "; line2 = STDIN.gets.chomp() | |
print "Line 3: "; line3 = STDIN.gets.chomp() | |
puts "I'm going to write these to a file" | |
target.write(line1) | |
target.write("\n") | |
target.write (line2) | |
target.write("\n") | |
target.write(line3) | |
target.write("\n") | |
puts "And finally we close it." | |
target.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment