cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

On an X450a-48t is there a way to put more than one command on the command line ? e.g. in UNIX commands can be separated by a semi-colon

On an X450a-48t is there a way to put more than one command on the command line ? e.g. in UNIX commands can be separated by a semi-colon

John_Nicolson
New Contributor
On an X450a-48t is there a way to put more than one command on the command line ? For example in UNIX commands can be separated by a semi-colon
9 REPLIES 9

PARTHIBAN_CHINN
Contributor
Below is a perl script which I used to modify for all networking devices.
You just need to have similar commands in TCL and it will work

use Net::Telnet;$telnet = new Net::Telnet ( Timeout=>10,Errmode=>'die');
$telnet->open('10.209.70.x');
$telnet->login('admin', 'admin');
print $telnet->cmd('configure');
print $telnet->cmd('run show version');
sleep 1;
print $telnet->cmd('run show interfaces ge-0/0/0 brief | grep Physical ');
sleep 1;
print $telnet->cmd('exit');
print $telnet->cmd('set cli screen-length 0'); ------------Instead say disable clipaging
print $telnet->cmd('configure');
print $telnet->cmd(' run show log messages | grep ge-0/0/0 | last 10 ');#this works now
sleep 10;
$counter = 0;
while ($counter < 3)
{
chomp ();
open (FILE, ">gilly.txt");
print FILE (print $telnet->cmd(' run show spanning-tree interface '));
sleep .5;
close (FILE);
$counter = $counter + 1;
}

John_Nicolson
New Contributor
I want to run an automated script from a UNIX platform that connects to an X450 (using UNIX Expect TCL), enters the password, then runs command(s) and exits the X450 once the prompt re-appears. It's fairly straightforward to get this to happen for a simple comand like 'show slot'. But a command like 'show ipstats' requires 'disable clipaging' or it will stop at the 'Press SPACE to continue' prompt. If I was doing this sort of thing to another UNIX server I would simply send "disable clipaging ; show ipstats" or indeed any set of commands serperated by a semi-colon.

I can't test right now, but would inserting a \n between commands would work? Worth the try.

PARTHIBAN_CHINN
Contributor
I would like to understand the question again.
The reason I would want such a feature is to do things faster.

EXOS has better options.
It supports CLI scripting.

enable cli-scripting
Sample cli scripts

The following script displays the date and time:set var CLI.OUT " "
show switch
set var date $TCL(lrange ${CLI.OUT} 27 29)
set var year $TCL(lrange ${CLI.OUT} 31 31)
set var date $TCL(linsert $date 3 $year)
set var time $TCL(lrange ${CLI.OUT} 30 30)
show var date
show var time
The following script sorts the FDB table in descending order:
set var CLI.OUT " "
show fdb
set var x1 $TCL(split ${CLI.OUT} "\n")
set var x2 $TCL(lsort -decreasing $x1)
set var output $TCL(join $x2 "\n")
show var output
The following script extracts the MAC address given the age of an FDB entry:
set var CLI.OUT " "
show fdb
set var input $TCL(split ${CLI.OUT} "\n")
set var y1 $TCL(lsearch -glob $input *age*)
set var y2 $TCL(lindex $input $y1)
set var y3 $TCL(split $y2 " ")
set var y4 $TCL(lindex $y3 0)
show var y4

Paul_Russo
Extreme Employee
Hey John

No you can't put more than one command in at a time but what I normally do is type the commands in notepad or something and then just copy and paste them into the CLI. Doing that allows for you to enter any amount of commands at one time.

Thanks
P
GTM-P2G8KFN