From: Matthew Kerwin Date: 2012-09-14T08:42:43+09:00 Subject: Re: \b not working? On 14 September 2012 09:24, Cookie Rubster wrote: > Hi, > > New to Ruby and can't seem to get the \b escape to work. Code: > > j=0 > while j<10 > print rand(1...10) > sleep (0.1) > print "\b" > j+=1 > end > > Output: > > 4523175329 > - just a series of 10 random numbers on the same line. > > Am I missing something, or shouldn't it backspace, and print all the #s > in the first character space? > > Your help appreciated! > Jeff In short: it depends where you're printing it. The raw bytes streaming from your program's $stdout stream include a bunch of digits (value 0x30 to 0x39) and the odd "\b" (0x08). It's up to the terminal/console/etc. that receives them and formats them for display to interpret the 0x08-bytes the way you intended. Where are you running said script? (Which operating system, terminal emulator, etc.?)