LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I am not able to come out of Expect (https://www.linuxquestions.org/questions/linux-newbie-8/i-am-not-able-to-come-out-of-expect-888737/)

xombboxer 06-28-2011 05:40 AM

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 ?

Simon Bridge 06-28-2011 05:48 AM

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?

xombboxer 06-28-2011 05:48 AM

Mistake :( , but i had already corrected it

xombboxer 06-28-2011 05:50 AM

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

Simon Bridge 06-28-2011 07:18 AM

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.


All times are GMT -5. The time now is 12:30 AM.