EXPECT module, howto to perform a "new page" ?

Discussion in 'Perl' started by z0mb1e_fr, Nov 28, 2003.

  1. z0mb1e_fr

    z0mb1e_fr Guest

    I am writing a script to change a router config.
    The config is long and the result is that the display stops with a
    "--more--".

    Normally we type return to go to a new line or the space bar to go to
    scroll down a page.

    So far I failed to simulate this behaviour with expect.

    The program performs a loop with:
    ....
    ....
    $router->expect($timeout, "-re" , "--More--"))
    print $router "\f";
    ....
    ....

    I tried "\f", "\s", "\f\r", "\r", nothing works.

    How can I tell expect to strike the "space bar" ?

    Thanks,

    Antonin
     
    z0mb1e_fr, Nov 28, 2003
    #1
    1. Advertising

  2. z0mb1e_fr

    Bill Guest

    (z0mb1e_fr) wrote in message news:<>...
    > I am writing a script to change a router config.
    > The config is long and the result is that the display stops with a
    > "--more--".
    >
    > Normally we type return to go to a new line or the space bar to go to
    > scroll down a page.
    >
    > So far I failed to simulate this behaviour with expect.
    >
    > The program performs a loop with:
    > ...
    > ...
    > $router->expect($timeout, "-re" , "--More--"))
    > print $router "\f";
    > ...
    > ...
    >
    > I tried "\f", "\s", "\f\r", "\r", nothing works.
    >
    > How can I tell expect to strike the "space bar" ?
    >


    What is a space character? try typing ' '.

    Why is this needed anyway? Most programs will not do the --more--
    thing if they are redirected to a file--why not redirect to file and
    the read the file?
     
    Bill, Dec 1, 2003
    #2
    1. Advertising

  3. z0mb1e_fr

    z0mb1e_fr Guest

    (Bill) wrote in message news:<>...
    > (z0mb1e_fr) wrote in message news:<>...
    > > I am writing a script to change a router config.
    > > The config is long and the result is that the display stops with a
    > > "--more--".
    > >
    > > Normally we type return to go to a new line or the space bar to go to
    > > scroll down a page.
    > >
    > > So far I failed to simulate this behaviour with expect.
    > >
    > > The program performs a loop with:
    > > ...
    > > ...
    > > $router->expect($timeout, "-re" , "--More--"))
    > > print $router "\f";
    > > ...
    > > ...
    > >
    > > I tried "\f", "\s", "\f\r", "\r", nothing works.
    > >
    > > How can I tell expect to strike the "space bar" ?
    > >

    >
    > What is a space character? try typing ' '.
    >
    > Why is this needed anyway? Most programs will not do the --more--
    > thing if they are redirected to a file--why not redirect to file and
    > the read the file?


    I tried that already.
    However I read line by line '\r\n' and that works fine.

    Antonin
     
    z0mb1e_fr, Dec 3, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maric Michaud
    Replies:
    0
    Views:
    7,203
    Maric Michaud
    Jun 24, 2006
  2. Simon Strandgaard

    how to expect eof with expect+pty

    Simon Strandgaard, Dec 20, 2006, in forum: Ruby
    Replies:
    4
    Views:
    366
    Simon Strandgaard
    Dec 20, 2006
  3. Praveen Ray

    Expect.pm like module in ruby

    Praveen Ray, May 6, 2008, in forum: Ruby
    Replies:
    1
    Views:
    145
    Ryan Davis
    May 6, 2008
  4. Replies:
    0
    Views:
    119
  5. Phil
    Replies:
    0
    Views:
    171
Loading...

Share This Page