| midrange.com code scratchpad | 
				
					| 
							
								| Name:sftp Script | Scriptlanguage:Plain Text | Tabwidth:4 | Date:06/25/2009 04:49:59 pm | IP:Logged |  | 
				
					| Description:The user was to lazy to give a description | 
				
					| Code: 
							
								
								
								| 
    #!/bin/sh                                                           
                                                                    
build_script() {                                                    
                                                                    
cat <<End-of-message                                                
#!/home/palhc/expectScript/expect.5.43 -f                           
spawn sftp ${USER}@${SFTPHOST}                                      
expect "connecting (yes/no)?" { send "yes\n"; expect "Password:" } \
       "Password:"                                                  
send "${PASSWORD}\n"                                                
expect "sftp>"                                                      
send "cd /Export\n"                                                 
send "get ${GETFILE} /home/palhc/ \n"                               
expect "sftp>"                                                      
expect "sftp>"                                              
send "quit\n"                                               
End-of-message                                              
                                                            
}                                                           
                                                            
build_script | /home/palhc/expectScript/expect.5.43.tar -f -
  |  | 
				
					|  |