chimni has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, I wanted some advice to go about disabling a port using the Net::telnet::cisco module. When i run the disable cmd through the script it waits for a 'y' or 'n' output at the router prompt . HOw to perform this interaction vie the script. i.e send a 'y' to disable the port regards rajdeep
  • Comment on Disabling a port using Net::telnet:Cisco

Replies are listed 'Best First'.
Re: Disabling a port using Net::telnet:Cisco
by zengargoyle (Deacon) on Jul 28, 2003 at 08:36 UTC

    assuming the confirmation line comes immediately after the command try sending the 'y' with the command separated by a newline.

    $cmd = 'disable port p1/1/0\ny';

    i think i've gotten this to work before, but i might have been using Expect.

    alternatively i think you can set the prompt string to match the question.

    # pseudocode $realprompt = 'rtrname#'; $quesprompt = '[y/n]?'; $conn->prompt($quesprompt); $conn->cmd('disable port p1/1/1'); # and wait for quesprompt $conn->prompt($realprompt); # reset prompt $conn->cmd('y'); # and wait for realprompt
      Thank you for your assistance.
      I got it working.