EXPECT-Problem detecting telnet prompt

Discussion in 'OT Technology' started by ranthal, Aug 11, 2008.

  1. ranthal

    ranthal i did what?

    Joined:
    Feb 8, 2007
    Messages:
    772
    Likes Received:
    0
    Location:
    Los Angeles
    So I have set up a bash script that sets options and calls an expect script that spawns a telnet session which can have multiple prompts. The expect statement is having trouble detecting the prompts tho I can clearly see that it appears. Before I get into too much detail here is the code in brief:

    set prompt "(BDI>|bft_8250>|bft_fpga>|bft_kernel>) $"; #multiple possible prompt commands

    # Call to telnet process
    BDITelnet $GlobalData(configFile) $prompt $GlobalData(bdiIPAddress) $GlobalData(hostIPAddress) $GlobalData(progEnable) $GlobalData(flashFile)

    proc BDITelnet { configFile configPrompt bdiIPAddress hostIPAddress bdiProg flashFile } {
    ...
    expect \
    $configPrompt \
    { send "res halt\r" } \
    timeout \
    { set status 1; \
    set GlobalData(errorMessage) "Waiting for prompt failed" }
    ...
    }

    So it keeps timing out and the prompt as it appears in the telnet seesion is "bft_8250>". Any ideas? Is it a reg ex/or problem? Post questions if you have them, I kept this short and lacking a lot since I haven't had too great of a response from other EXPECT questions here.
     
  2. ranthal

    ranthal i did what?

    Joined:
    Feb 8, 2007
    Messages:
    772
    Likes Received:
    0
    Location:
    Los Angeles
    no expect scripters here at all?
     
  3. HY

    HY New Member

    Joined:
    Dec 10, 2006
    Messages:
    57
    Likes Received:
    0
    negative, never used expect. but can you just blindly pipe what ever you need in or only for specific cases. not really an answer to your question but there is a python expect module that i have used that makes it pretty easy.
     

Share This Page