Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9149155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:26:19+00:00 2026-06-17T11:26:19+00:00

I am new with expect scripting. I’m trying to backup Huawei router configuration with

  • 0

I am new with expect scripting. I’m trying to backup Huawei router configuration with automated telnet script. I’m stuck in handling one string “—More—“, it’s like press any key to continue where I would like to send “\n”

My router output is like:

--------------------------------
-----------------------
voice-vlan mac-address 00d0-1e00-0000 mask ffff-ff00-0000 description Pingtel phone
voice-vlan mac-address 00e0-7500-0000 mask ffff-ff00-0000 description Polycom phone
voice-vlan mac-address 00e0-bb00-0000 mask ffff-ff00-0000 description 3com phone
#
---- More ----

And My Script is :

#!/usr/bin/expect
spawn telnet 192.168.xx.xx
expect "Username:"
send "username\n"
expect "Password:"
send "password\n"
expect ">"
# 'dis cur' is like cisco's 'show run'
send "dis cur\n"
expect "---- More ----"
send "\n"
interact

While running the script terminal throwing me this error:

  bad flag "---- More ----": must be -glob, -regexp, -exact, -notransfer, -nocase, -i,      -indices, -iread, -timestamp, -timeout, -nobrace, or --
while executing
"expect "---- More ----""

Can anyone help fixing this?… Thanks in advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:26:20+00:00Added an answer on June 17, 2026 at 11:26 am

    Quick answer: put -ex in front of the string that starts with a - so that the expect code can know for sure that it isn’t an option.

    However, aside from the quick answer you should do a somewhat more sophisticated version:

    expect {
        ">" {
            # Found prompt
        }
        -ex "---- More ----" {
            send "\n"    ;# Or maybe \r?
            exp_continue ;# Keep on expecting please
        }
    }
    interact
    

    This has the advantage of allowing zero, one or many occurrences of the pager output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very new to Bash scripting. I am trying to write a script
I'm pretty new to scripting in general. I'm writing an expect script that ssh'es
As one might expect I'm new to Objective-C and Cocoa2d so this might be
Is it possible to do some form of expect NEW in rhino mock. Example:
I am new to using expect, and I've searched for an answer to the
I would expect a Dictionary object of the form: var dict = new Dictionary<string,string>()
interval = new Date(0); return interval.getHours(); The above returns 16. I expect it to
See this code: TicketStoreService fakeTicketStoreService = MockRepository.GenerateMock<TicketStoreService>(); fakeTicketStoreService.Expect(service => service.DoSomething(Arg.Is(new Guid())) .Return(new Guid()); fakeTicketStoreService.DoSomething(Arg.Is(new
new to c#. I'm trying to make a simple system where I can search
I'm very new to scripting and SQL and I've inherited a crazy database generated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.