Embed expect in bash script
Hi guyz,
I am trying to embed expect in my bash script to perform some tasks, can anyone please let me know whatz wrong in this script. Thanks in advance.
USER="username"
PASS="password"
NAMES=`cat full_list`
for i in $NAMES
do
echo $i
OUTPUT=$(expect -c "
spawn rpm2ipc -p 3004334 RHEL5.4_RPMS/$i
expect {
Enter userID: { send \"$USER\r\"; exp_continue }
expect {
Enter password: { send \"$PASS\r\"; exp_continue }
}
")
The script initially reads a files containing a list of rpm's on each line and then spawns the rpm2ipc command which uploads the particular rpm to a repository.
During this process it tries to enter the credentials, where it is failing.
Any pointers ??
|