LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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
 
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
Posts: 6,443
Blog Entries: 3

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

Rep: Reputation: Disabled
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: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,533
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
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 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 11:37 AM.

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 Google+: linuxquestions
Open Source Consulting | Domain Registration