LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
LinkBack Search this Thread
Old 05-14-2010, 01:08 PM   #1
prpednek
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.

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 ??
 
Old 05-15-2010, 06:31 AM   #2
MTK358
LQ 5k Club
 
Registered: Sep 2009
Distribution: Arch x86_64
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 707Reputation: 707Reputation: 707Reputation: 707Reputation: 707Reputation: 707Reputation: 707
WTF is "expect"?
 
Old 05-15-2010, 06:34 AM   #3
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Laptop: Slackware 13.37 // Desktop: Slackware64 13.37 // Netbook: Slackware 13.37
Posts: 5,477
Blog Entries: 48

Rep: Reputation: 641Reputation: 641Reputation: 641Reputation: 641Reputation: 641Reputation: 641
http://en.wikipedia.org/wiki/Expect
 
Old 05-15-2010, 06:36 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Slackware 13.37, Debian Squeeze
Posts: 7,981
Blog Entries: 25

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


Reply

Tags
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] I have commandline want to embed in a script markotitel Programming 17 05-04-2010 07:13 PM
Expect script: how do i send function key F12 in an expect script alix123 Programming 1 11-20-2008 12:07 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 07:23 PM.

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