Last active
July 30, 2016 13:26
-
-
Save adamjstewart/930c637515c9040b593f140da3e8dcfc to your computer and use it in GitHub Desktop.
Automate login to multiple CVS repositories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env expect | |
# Automates CVS login to ocr, hwr, and rcr. | |
# Prompts user for password a single time. | |
# Turn off timeout | |
set timeout -1 | |
# Ask user for password | |
stty -echo; # make sure password isn't echo'ed | |
send "Please input your CVS login password: " | |
expect -re "(.*)\n" | |
send "\n" | |
# Set username and password | |
set username $env(USER) | |
set password $expect_out(1,string) | |
# First logout of all three | |
foreach directory [list ocr hwr rcr] { | |
spawn -noecho cvs -d ":pserver:$username@cvs:/export/cvs/$directory" logout | |
expect eof | |
} | |
# Now login to all three | |
foreach directory [list ocr hwr rcr] { | |
spawn -noecho cvs -d ":pserver:$username@cvs:/export/cvs/$directory" login | |
expect "CVS password: " | |
send "$password\r" | |
expect eof | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment