Solved

expect script no longer works

Posted on 2002-07-17
2
213 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
2 Comments
 
LVL 1

Accepted Solution

by:
m4rc earned 200 total points
Comment Utility
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
Comment Utility
a little sleep does wonders  
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now