LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-02-2003, 09:53 PM   #1
TomCruise2002
LQ Newbie
 
Registered: Sep 2002
Posts: 12

Rep: Reputation: 0
Unhappy How to use expect


Please help me with the expect utility.

I need to scp some files to a remote server. I have the script below:

#!/usr/bin/expect -f
set myhost 10.10.1.43
spawn scp -pr /root/temp/ $myhost:/usr/local/inventory
expect $myhost
send "AbcDeFg\n"
interact

This script works if the password is correct and the server is running. The problem is how to care of the following:
1. When the password is wrong, the program stops and does not timeout because another prompt appears and it is wating user input.
2. When the remote server is down/hanging, the program also hangs and does not timeout.

How can I fix this? Please help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Expect Script coolest Programming 7 02-16-2009 03:59 PM
Expect how to? e-freak Programming 2 09-24-2005 04:49 AM
help with expect neyoung Programming 3 02-09-2004 09:41 PM
Using Expect for Linux rkeng Linux - General 2 08-01-2003 09:01 PM
expect sk8guitar Programming 3 07-29-2003 09:24 PM


All times are GMT -5. The time now is 08:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration