The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Expect script on crontab ap1030 Shell Programming and Scripting 6 06-04-2009 02:09 PM
Help with expect script somedude Shell Programming and Scripting 4 06-04-2009 01:39 PM
Need Help with EXPECT script markus2008 UNIX for Advanced & Expert Users 5 03-12-2008 08:49 PM
Expect Script - error using sed - tony3101 Shell Programming and Scripting 4 10-12-2006 05:09 PM
Expect Script HELP zuinc Shell Programming and Scripting 2 04-30-2002 10:42 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-02-2004
maeve maeve is offline
Registered User
  
 

Join Date: Jun 2004
Posts: 1
help with 'expect' script?

Hi scripting gurus,

I have the following EXPECT script, which I created initially using AUTOEXPECT, and then I took some stuff out.

#!/usr/bin/expect -f
#
set force_conservative 1 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}

set timeout -1
spawn su -l --c=pine rusty
match_max 100000
expect -exact "Password: "
send -- "gate\r"
expect -exact " Gt^C G0 Cancel GtRet G0 Accept =7U Gt =5 HOST:
xxxxxxxx ENTER LOGIN NAME \[rusty\] : =6 =5`"
send -- "\r"
expect -exact " G0 =5 Gt = o+ =! G0 Gt =5 HOST: xxxxxx USER:
rusty ENTER PASSWORD: =6 =5`"
send -- "gate\r"

What I want is for the script to ‘su’ to RUSTY, with automatic
filling-in of the password, to launch PINE with an automatic
ENTER on the default user name and automatic filling-in of the
password, and then for EXPECT to get out of the way, not testing
for any further keyboard entry.

Also, if possible, I only want EXPECT to test for the above PINE
prompts once.

The script as is gets into PINE okay, but it then immediately
drops back the command line. I tried (re)adding 'expect eof', but
it then doesn't pass my keystrokes through to PINE.

The problem is that I don’t know what lines I must add to the
script to tell EXPECT to butt out once it has found and responded
to the above prompts.

Can anyone help?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0