[ create a new paste ] login | about

Link: http://codepad.org/URA4XvZr    [ raw code | output | fork ]

Ruby, pasted on Dec 1:
filename = ARGV.first
script = $0

puts "we are going to earse #{filename}."
puts "if you dont want that, hit Ctrl-C now!
puts "if you do want that, hit RETURN"

print "?"
STDIN.gets

puts "opening the file..."
target = File.open(filename, 'w')

puts "nuking the file. Goodbye!"
target.turncate(target.size)

puts " now i am going to ask you for three lines"

print "line 1: " line1 = STDIN.gets.chomp()
print "line 2: " line2 = STDIN.gets.chomp()
print "line 3: " line3 = STDIN.gets.chomp()

puts " I am going to write these to the 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()


Output:
Line 6: syntax error, unexpected tCONSTANT, expecting kDO or '{' or '('
puts "if you do want that, hit RETURN"
                                     ^
Line 11: syntax error, unexpected tIDENTIFIER
puts "opening the file..."
             ^
Line 14: warning: parenthesize argument(s) for future version
Line 14: syntax error, unexpected tIDENTIFIER, expecting kEND
puts "nuking the file. Goodbye!"
            ^
Line 17: warning: parenthesize argument(s) for future version
Line 17: warning: parenthesize argument(s) for future version
Line 17: syntax error, unexpected tIDENTIFIER, expecting kEND
puts " now i am going to ask you for three lines"
          ^
Line 17: syntax error, unexpected tIDENTIFIER, expecting kDO or '{' or '('
puts " now i am going to ask you for three lines"
                                                ^
Line 19: syntax error, unexpected tIDENTIFIER, expecting kEND
print "line 1: " line1 = STDIN.gets.chomp()
           ^
Line 20: syntax error, unexpected tIDENTIFIER, expecting kEND
print "line 2: " line2 = STDIN.gets.chomp()
           ^
Line 21: syntax error, unexpected tIDENTIFIER, expecting kEND
print "line 3: " line3 = STDIN.gets.chomp()
           ^
Line 23: syntax error, unexpected tCONSTANT, expecting kEND
puts " I am going to write these to the file."
        ^
Line 23: syntax error, unexpected tSTRING_BEG
puts " I am going to write these to the file."
                                              ^
Line 26: syntax error, unexpected $undefined, expecting kEND
target.write("\n")
               ^
Line 28: syntax error, unexpected $undefined, expecting kEND
target.write("\n")
               ^
Line 30: syntax error, unexpected $undefined, expecting kEND
target.write("\n")
               ^
Line 32: syntax error, unexpected ',', expecting kEND
puts "and Finally, we close it"
                  ^
Line 32: unterminated string meets end of file
Line 32: warning: parenthesize argument(s) for future version
Line 32: warning: parenthesize argument(s) for future version
Line 32: syntax error, unexpected $end, expecting kEND


Create a new paste based on this one


Comments: