Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 05-14-2010, 01:08 PM   #1
LQ Newbie
Registered: Mar 2010
Location: India
Distribution: RHEL
Posts: 22

Rep: Reputation: 16
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.


NAMES=`cat full_list`
for i in $NAMES
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 ??
Old 05-15-2010, 06:31 AM   #2
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
WTF is "expect"?
Old 05-15-2010, 06:34 AM   #3
LQ 5k Club
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
Old 05-15-2010, 06:36 AM   #4
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1193Reputation: 1193Reputation: 1193Reputation: 1193Reputation: 1193Reputation: 1193Reputation: 1193Reputation: 1193Reputation: 1193
Originally Posted by MTK358 View Post
WTF is "expect"?
Have a look at some LQ threads.


bash, embed, expect

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 09:06 PM
[SOLVED] I have commandline want to embed in a script markotitel Programming 17 05-04-2010 07:13 PM
Unexpected curly braces in expect script spawn command & bash suid problem slinx Programming 1 05-02-2008 01:47 PM
can expect be called from within a bash script? johnpaulodonnell Programming 4 06-21-2007 09:42 AM
Combined bash and expect script Paul77 Linux - Software 11 03-08-2007 09:17 AM

All times are GMT -5. The time now is 03:33 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration