![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
| Display Modes | Rate This Thread |
|
|