Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

expect script no longer works

Posted on 2002-07-17
2
Medium Priority
?
220 Views
Last Modified: 2010-08-05
Hi,
 I have an "expect" script that runs fine on redhat 7.2,
but intermittenly works on redhat 7.3 (2.4.18-5). The expect script runs the passwd command to set a password to some variable. I can get the script if i add extra "returns" after sending the password. This is another querky issue that came about with this kernel, and I am wondering if it related.
Here is a snip of the script:
---------------snip---------------------
spawn /usr/bin/passwd $USER
expect {
       default { send_user "EXIT ERROR" ; exit 1 }
       "assword:"
       }
send "$PASS\r"
expect {
       default { send_user "EXIT ERROR" ; exit 1 }
       "assword:"
       }
send "$PASS\r"
expect {
       default { send_user "Completed.\n" ; exit 1 }
       }
send_user "\n Done.\n"
exit 0
--------------------------------------------
In order to make it work on 2.4.18-5, I have to
add extra "returns" to send $PASS, ie:
send "$PASS\r\r\r\r"
That works 100%, but is goofy , something is wacked!
0
Comment
Question by:medent
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
m4rc earned 400 total points
ID: 7203702
expect can be goofy.  many problems ive run into are based on timing, and can be solved by slowing down the script to human speed, or adding sleep statements.
0
 

Author Comment

by:medent
ID: 7204059
a little sleep does wonders  
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question