home   articles   tags   browse code   

Linux SCP Expect Script


 

usage: expect_scp.exp myfile.7z
file: expect_scp.exp
#!/usr/bin/expect -f
set filename [lindex $argv 0]
set timeout -1
spawn scp $filename myusername@192.168.1.123:/home/myusername/
set pass "mypassword"
expect {
        password: {send "$pass\r" ; exp_continue}
        eof exit
}


192.168.1.123 - change to the ip address of destination server
myusername - change to user account of destination server
mypassword - change to password of user account of destination server


 

Tags: bash, linux
 
lois garcia on Jul 29th, 2010 6:13 pm said:
THANK YOU! Exactly what I needed. Now, to add an array...
 



 

 



Related Articles
 



home  |  privacy policy  |  terms of use  |  contact  


©2012, Zedwood.com

zedwood.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com