cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5134
Views
0
Helpful
2
Replies

Get Username from configuring user with tcl

patrick.goetz
Level 1
Level 1

Hello together,

how can I get the username of the user who is configuring on the ios shell and saved the running-config to memory with TCL?

The username should be saved into a variable and will be put out as part of a filename.

Do you have an idea how to script that?

BR Patrick

2 Replies 2

patrick.goetz
Level 1
Level 1

I found a variable which is filled with the active user logged on to the router....

set username $tcl_platform(user)

set location sup-bootflash:$username.conf

when i check the variable on the tclsh I get the output of my current user who is logged on

If I check the output of $username it is blank and not filled.

any idea`?

This is working for me.  I can't explain why a variable would be empty after you set it:

NE100(tcl)#puts $tcl_platform(user)

user1

NE100(tcl)#set username $tcl_platform(user)

user1

NE100(tcl)#puts $username

user1

NE100(tcl)#set username $tcl_platform(user)

user1

NE100(tcl)#

NE100(tcl)#set location sup-bootflash:$username.conf

sup-bootflash:user1.conf

NE100(tcl)#

NE100(tcl)#

NE100(tcl)#

As a workaround, you can access $tcl_platform(user) directly.  Does this work for you?

set location sup-bootflash:$tcl_platform(user).conf