What is wrong with my expect script?
Posted
by Bryan
on Server Fault
See other posts from Server Fault
or by Bryan
Published on 2010-05-04T13:01:30Z
Indexed on
2010/05/04
13:08 UTC
Read the original article
Hit count: 287
I'm trying to learn how to use the expect command, to help me automate deployment of some software via shell scripts, and figured I start with something simple to get me started.
I've created a file in my home dir called 'foo' using:
touch foo
And I've created the following script saved as test.exp
#!/usr/bin/expect
spawn rm -i foo
expect "rm: remove regular empty file `foo'?"
send "y\r"
When I run the script using ./test.exp
, it spawns the rm command, but it doesn't appear to send the Y and carriage return.
I know I don't have a typo in the expect string, as I've used copy and paste to put in the script.
What am I doing wrong?
© Server Fault or respective owner