cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1725
Views
0
Helpful
1
Replies

TCL help passing an arguement

tearl42
Level 1
Level 1

Hi there! 

 

I need some help. I haven't been a hands-on network engineer in a long time so please excuse my lack of scripting knowledge. I have been asked to write a script that will change the configuration on a given port in the event of a reachability issue. Sorry if that's vague. My thought is to have a TCL script to change the configuration on the port. I have it working if I put in the interface in the script, but I want to make it dynamic so the user can define the port that needs to be changed. I would also like an "are you sure?", but one problem at a time. How do I pass an argument to the script? tclsh flash:test.tcl <arguement> is how I would think to do it, but I'm getting errors. 

 

##
## Test script
tclsh

{
##
## Switch port config
##
ios_config "int" $argv0 "desc Changed from Script "
}
tclquit

 

Thanks in advance for your help!

 

Tom

1 Reply 1

Dan Frey
Cisco Employee
Cisco Employee

Change the argument index to a variable in the tcl file.

tclsh flash:stream.tcl 192.168.1.1 12345

# Add these two lines in the tcl file.

set server [lindex $argv 0]

set udp_port [lindex $argv 1]