expect write to variable text with waste “new line symbol” from output line
how to solve this problem?
#!/usr/local/bin/expect -f
set timeout 30
puts "enter the path to output folder"
while 1 {
expect {
"*\n" {
set outdir $expect_out(buffer)
break
} timeout {
puts "warning: timed out"
set outdir $DEFAULT_OUT
break
}
}
}
Also, check the expect man page, there are a few examples of user entry: