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: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
WTF is "expect"?
 
Old 05-15-2010, 06:34 AM   #3
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; Slackware64-current (VM); Debian 12 (VM)
Posts: 8,290
Blog Entries: 61

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: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:53 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration