Created
November 29, 2011 06:25
-
-
Save cammckinnon/1403695 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/expect -f | |
set user [lindex $argv 0] | |
set pass [lindex $argv 1] | |
set file1 [lindex $argv 2] | |
set file2 [lindex $argv 3] | |
spawn scp $file1 $file2 [email protected]:~ | |
expect "*?password:*" | |
send "$pass\r" | |
send "\r" | |
expect eof | |
spawn ssh [email protected] | |
expect "*?password:*" | |
send "$pass\r" | |
expect "*>*" | |
send "cd ~\r" | |
expect "*>*" | |
send "source /u/cs241/setup\r" | |
expect "*>*" | |
send "cs241.linker $file1 $file2 > final.merl\r" | |
expect { | |
"*ERROR*" { | |
send "exit\r" ; | |
expect eof | |
exit 2 | |
} | |
"*>*" { | |
send "java cs241.merl 0 < final.merl > final.mips\r" | |
expect "*>*" | |
send "exit\r" | |
expect eof | |
spawn scp [email protected]:~/final.mips . | |
expect "*?password:*" | |
send "$pass\r" | |
send "\r" | |
expect eof | |
exit 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment