I’m trying to automatize some tool, and I have
spawn /home/rundoc.sh $path $view expect "Please enter correct product number []" sleep 2 send "CX102504r"
Problem is that by default in prompt is added last product number , for example
Please enter correct product number [] CX000001
When I run my expect script in prom is added
Please enter correct product number [] CX000001CX102504
So how I can tell in except that send BACKSPACE (delete) default product number add set only new one in prompt for example , something like
send "<BACKSPACE><BACKSPACE><BACKSPACE><BACKSPACE><BACKSPACE>CX102504r"
Advertisement
Answer
Alternately you could use 25
once — that is Ctrl-U which (for readline editing) removes everything between the cursor and the start of the line.