cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2004
Views
0
Helpful
3
Replies

TcL Initialize Arguments Question

Cory Anderson
Level 1
Level 1

I'm reading through the book & it's unclear to me how to do an argument for running a script.  What I'm trying to do is something like this:

tclsh flash:/test.tcl username password ip_address

Where username & password would be an scp username & password & ip_address would be scp ip address.  I'm thinking this is related to the argv arg0, but I don't see a specific example.

Thanks,

Cory Anderson

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Yup:

set username [lindex $argv 0]

set password [lindex $argv 1]

set my_script_name $argv0

View solution in original post

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

Yup:

set username [lindex $argv 0]

set password [lindex $argv 1]

set my_script_name $argv0

Thanks Joseph,

I was hoping it was that easy.  Is there a limit to the amount of arguments that I can have for initialization?

Not reall, but practically, you're limited by I believe 256 characters of the IOS CLI.