# TCL stdin

**URL:** https://forum.kirupa.com/t/tcl-stdin/331509
**Category:** programming
**Created:** [August 14, 2013, 4:09pm UTC](https://forum.kirupa.com/t/tcl-stdin/331509 "2013-08-14T16:09:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bdan](https://avatars.discourse-cdn.com/v4/letter/b/f07891/32.png) [@bdan](https://forum.kirupa.com/u/bdan)
#### Post date: [August 14, 2013, 4:09pm UTC](https://forum.kirupa.com/t/tcl-stdin/331509/1 "2013-08-14T16:09:30Z")

</div>

This is my first post. My question is when using the following

puts “What show command would you like to execute? Type ‘stop’ to close dialog.”  
set cmd [gets stdin]

proc makeLC {str} {  
puts “begin”  
puts $str  
set lStr [string tolower $str]  
set lStr [string trim $lStr]  
puts “after low and trim”  
puts $lStr  
puts “scan”  
puts [scan $lStr %s]

```
set lenStr [string length $lStr]
for {set i 0} {$i &lt; $lenStr} {incr i} {
    puts [string index $lStr $i]
}
return $lStr

```

}

set lcmd [makeLC $cmd]

When a user types “test12345” then backspaces to display “test123” then adds “67” to finally display “test12367”  
puts $lStr returns “test12367”  
but the for loop will display “test12345 67” the spaces between “12345” and “67” I believe are “\b\b”.  
Why the inconsistancy? and how do I ensure that when passing $lStr that “test12367” is assigned and “test12345 67” is not?
