#!/usr/bin/ruby def ttyin tty = open("/dev/tty", "r") if ( (s = tty.gets) == nil || s[0,1] == "q" ) exit else return s[0,1] end end STDOUT.print "swap nl with space (y/n)? " ans = ttyin if (ans == "y" || ans == "Y") while (s = gets) print s.chomp, " " end print "\n" else while (s = gets) puts end end