Solved

expect script no longer works

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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…
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…

770 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