medent
asked on
expect script no longer works
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!
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!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER