TCL array values updation based on command line argument

Posted by Raj on Stack Overflow See other posts from Stack Overflow or by Raj
Published on 2010-04-06T21:32:23Z Indexed on 2010/04/06 21:53 UTC
Read the original article Hit count: 602

Filed under:

Hi,

I am trying to substitute variable value inside array so as to update array values based on command line inputs. e.g. I am receiving IP address as command line argument for my TCL script and trying to update commands with recvd IP value.

My array is:

array set myArr { 1 myCmd1("192.268.2.1","abc.txt") 2 myCmd2("192.268.2.1","xyz.txt") 3 myCmd3("192.268.2.1","klm.txt") }

Here, "192.268.2.1" will actually be supplied as command line argument.

I tried doing

array set myArr { 1 myCmd1($myIP,"abc.txt") 2 myCmd2($myIP,"xyz.txt") 3 myCmd3($myIP,"klm.txt") }

and other combinations like ${myIP}, {[set $myIP]} but none is working.

Thanks in advance for any help/inputs.

© Stack Overflow or respective owner

Related posts about tcl