LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-28-2011, 05:40 AM   #1
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Rep: Reputation: 0
I am not able to come out of Expect


I am using expect command to pass password to my script.

like

Code:
#!/usr/bin/expect -f
set send_human {.1 .25 2 .05 1.5}

set breaktheloop 0

while {$breaktheloop == 0} {
        expect "*Password:*"
#       send -h "$pass\r"
        send -h "$p\r"
        expect -timeout -1  "... Writing FlashHeader"
	sleep 10
	set breaktheloop 1
it will send password properly, but after that it will not come out of expect to bash

any help ?

Last edited by xombboxer; 06-28-2011 at 05:44 AM.
 
Old 06-28-2011, 05:48 AM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Your question is ambiguous - in the title you say you cannot come out of expect, but in the body you say you do come out of expect.
The script you show us just ends after sending the password - thus it should exist to bash. What else would it do?
 
Old 06-28-2011, 05:48 AM   #3
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Original Poster
Rep: Reputation: 0
Mistake , but i had already corrected it
 
Old 06-28-2011, 05:50 AM   #4
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Original Poster
Rep: Reputation: 0
correct, it should exit to bash, but it is not. I think there is some trick in line
[CODE]
expect -timeout -1
[CODE]

Last edited by xombboxer; 06-28-2011 at 05:51 AM.
 
Old 06-28-2011, 07:18 AM   #5
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
expect(1) suggests you need to issue the "exit" command to exit expect.

exit [-opts] [status]
causes Expect to exit or otherwise prepare to do so.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 09:06 PM
[SOLVED] /usr/bin/expect : Script to check server load using both expect and bash Soji Antony Programming 1 07-27-2010 11:27 PM
expect: line seems to match exactly, however expect thinks not deadeyes Linux - General 5 06-16-2010 06:05 PM
Calling expect scripts from other expect scripts sevapopov Linux - Software 3 04-03-2008 09:33 PM
need help on expect pinoyskull Linux - General 2 01-31-2008 12:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:46 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration