WearyTraveler has asked for the wisdom of the Perl Monks concerning the following question:
How can I code this to leave me logged in at the command prompt?
This code works - it gives me the following output:#!/usr/bin/perl use Net::Telnet::Cisco ; my $switch = $ARGV[0] ; print "$switch \n" ; my $session = Net::Telnet::Cisco->new(Host => 'ba1-1'); $session->login('charlie', 'letmein'); # Enable mode if ($session->enable("letmein") ) { @output = $session->cmd('show privilege'); print "My privileges: @output\n"; } else { warn "Can't enable: " . $session->errmsg; }
[charlie@ion1 bin]$ goto ba1-1 ba1-1 My privileges: Current privilege level is 15 [charlie@ion1 bin]$
Thanks!
Charlie
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Telnet to Cisco command prompt...
by Illuminatus (Curate) on Sep 24, 2008 at 17:21 UTC | |
by WearyTraveler (Novice) on Sep 25, 2008 at 02:41 UTC | |
by Illuminatus (Curate) on Sep 25, 2008 at 16:08 UTC |