The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Is there a way to ask expect wait for sometime before running the next send command ? qiulang Shell Programming and Scripting 0 03-04-2009 02:57 AM
expect-string length problom sudheer157 UNIX for Advanced & Expert Users 2 02-06-2009 10:36 AM
wait command - cat it wait for not-chile process? alex_5161 Shell Programming and Scripting 2 06-26-2008 06:14 PM
check exit status - Expect Script iamcool Shell Programming and Scripting 1 01-02-2008 09:07 AM
Checking the header and trailer for a given string and if not found, exit out of the er_ashu UNIX for Dummies Questions & Answers 2 11-08-2007 09:55 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 1 Week Ago
ayucelen ayucelen is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 2
expect wait --More-- string and exit

Hi

I am programing a expect script on debian, I connected to a firewall to get configuration copy via telnet or ssh but Because of firewall show configuration console wait and print --More-- need press space key at least 100.Help me please.

firewall output like this
Quote:
-------------------------------------
firewall#show config
config line 1
config line 2
config line 3
config line 4
config line 5
config line 6
-----More--
This output isn't firewall full config and expect script wait and exit.Thus my expect script not run that I want.

my expect script is like this

Code:
***************expect.sh**********
#!/bin/expect
spawn telnet 10.1.1.1

expect -re "Login" {
                send "admin";
                }  

expect -re "Password" {
                send "123";
                }

expect -re "firewall#" {
                send "show config";
                }
exit
***********bash command***********
Debian#./expect.sh > backupfirewall.cfg
**********************************

Last edited by Neo; 1 Week Ago at 03:24 PM.. Reason: format please: use code and quote tags!
  #2 (permalink)  
Old 1 Week Ago
Neo's Avatar
Neo Neo is online now Forum Staff  
Administrator
  
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 6,650
My first thought is that you need to introduce a while statement in your expect script to read the troublesome -----More-- text and send a carriage return when it happens.
  #3 (permalink)  
Old 1 Week Ago
ayucelen ayucelen is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 2
Quote:
Originally Posted by Neo View Post
My first thought is that you need to introduce a while statement in your expect script to read the troublesome -----More-- text and send a carriage return when it happens.


Hi
Please show me on my script correct form.
  #4 (permalink)  
Old 1 Week Ago
Neo's Avatar
Neo Neo is online now Forum Staff  
Administrator
  
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 6,650
Quote:
Originally Posted by ayucelen View Post
Hi
Please show me on my script correct form.
You should do your work and post your attempt to write a script and not simply ask people to do your work for you. I have given you the basic idea, so I suggest you do some of your own work first and attempt to solve your problem yourself and post back your work.
Sponsored Links
Reply

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 03:47 AM.


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