Solved

expect script no longer works

Posted on 2002-07-17
2
219 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 200 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Fine Tune your automatic Updates for Ubuntu / Debian
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to moveā€¦
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

623 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