From: Tim Hunter Date: 2009-10-07T06:56:11+09:00 Subject: Re: Creating a pacifier in command line program Jerry Mr wrote: > I am trying to create a program that, at one part, replaces already > displayed on the line with another. > > For example: > > Lets say the program is recursing directories. > > It should display: > > checking c:\Program Files\ > > then when it is done with that directory replace that line with the > next, not create another below it. > > I have been unable to locate information about this, though I don't > really know what to call it. > > Thank you. I think this will work in Windows but I don't have it to test. It works in OS X and Linux terminal windows. Instead of terminating the output line with a \n (or allowing it to default to a \n), use \r instead. "\r" is a carriage return, so the cursor will return to the start of the same line and overprint it. For example, 10.times { |n| printf("Hello %d\r", n);sleep 1 } Will print Hello 0 Hello 1 Hello 2 etc., except each new "Hello" line overprints the previous one so you only see 1 line. -- RMagick is looking for a maintainer. Email me if you're interested.