Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8630939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:08:47+00:00 2026-06-12T09:08:47+00:00

Hi, all I have just found what cause these strange things. It’s the command:

  • 0

Hi, all

I have just found what cause these strange things. It’s the command: send “wait”

I wrote some scripts to test it.

proc Login {pass} {
# send the password
}

proc Wait {} {
    expect "*]$*"
    sleep 1
}

proc sendl {message} {
    send "$message\r"
}

spawn ssh xxxxx.xxx.xxx
Login xxxxxxxx
Wait

sendl "cd /somepath/"
Wait
sendl "expect infiniteLoop.exp >/dev/null &"
Wait
***sendl "wait"***
Wait

sendl "TESTTEST"
Wait
sendl "HAHAHA"
Wait
sendl "DONEDONEDONE"
Wait

It should be stuck after the line: sendl “wait”

But the result was:

[xxx@xxxxx.xxx ~]$ cd /somepath/
[xxx@xxxxx.xxx folder]$ expect infiniteLoop.exp >/dev/null &
[1] 27260
[xxx@xxxxx.xxx folder]$ wait
TESTTEST
HAHAHA
DONEDONEDONE
[xxx@xxxxx.xxx folder]$ 

The shell is still waiting, but the follow-up commands has been sent out one by one without any response. All the expect command after that line seems to be invalid. And then the script finished.

I don’t know what happened here. What cause expect commands invalid? The command “wait” seems not to be a program( I can’t use “whereis wait” find it).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:08:48+00:00Added an answer on June 12, 2026 at 9:08 am
    [xxx@xxxxx.xxx folder]$ wait
    TESTTEST
    HAHAHA
    DONEDONEDONE
    

    This kind of output is probably caused by expect timeout.

    I’m not sure what infiniteLoop.exp is doing. If it’s actually an infinite loop(or something taking a long time), the following wait shell command will always wait because the process(infiniteLoop.exp) never terminates.

    Therefore, the following Wait() proc invokes will eventually time out after each 10s (10s is Expect default timeout) and the script just continues like:

    sendl "TESTTEST"  (send message to spawned process)  
    Wait  (process still waiting for infiniteLoop.exp, timeout after 10s.)  
    sendl "HAHAHA"  (continue to send message)  
    Wait  (process still waiting for infiniteLoop.exp, timeout after 10s.)  
    sendl "DONEDONEDONE"  (continue to send message)  
    

    When the Expect script doesn’t tun as expected, I always do two things:

    • The first one is to run the procedure manually to check if there is something wrong.

    • The second one is adding -d option to turn on debugging message(ex: expect -d hello.exp).
      If you see something like “expect: timed out”, then the previous pattern is probably failed to match.

    BTW, you can add a little check to indicate the timeout case

    proc Wait {} {
        expect {
            "$" {}
            timeout {send_user "expect timeout\n"}
        }
        sleep 1
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just setup a wordpress forum and I find that all images are
We have just migrated from solr3.5 to solr3.6, for all this time we have
All, I have a basic Windows 7 Phone application and I have just finished
I just have a question thats been pozzling my head all morning. I want
I just have the array of 15 values that all need to be inserted
I'm in a project where all users from a LDAP server just have e-mails
I am using jScrollPane and are just testing it in all browsers and have
I have been browsing tutorials but all are just gibberish since I do not
I have an sql statement that currently is just returning all the end parent
I have an intent to another class and all it does it just flag

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.