I have a script that needs to switch between various branches in my subversion repository in order to do a copy. This results in having to enter the password repeatedly. Now, once I have done this a couple of time and i am well into my script. I mess up causing me great anger.
I have used expect to enter a password on a prompt before. I was hoping to learn how to get expect to run over multiple password prompts again and again and again, until the task is finished.
So far this is what I have.
#!/usr/bin/expect
global env
set timeout 10
spawn command that requires password
expect "^user"
send "password\r"
#i need this to repeat over and over until the prompt stops showing up.
Please and thank you.
Naive, brute force method:
Better: