tcl - create the variable's name after take off within a loop -


here's script:

#!/usr/bin/expect  set a1 "aaa" set a2 "bbb" set a3 "ccc"  {set b 1} {$b<4} {incr b} {    send a$b } 

the output :

 a1a2a3 

looks instead of values

$a1 $a2 $a3 

all got actual names of "variables" is

a1 a2 a3 

let's try code:

send $$b 

now output is

$1$2$3 

which means if can letter a sneaked there.. can create

$a1 $a2 $a3 

how can sneak letter "a" in there ?

after need like..

$c = $$b send $c 

which means values become $c , can execute $c send.

but

 $c = $$b 

is not working. , neither does.

 set c = $$b 

or

c=$$b 

ultimately goal print values for

$a1 , $a2 , $a3 

some recommended arrays , lists, seem either not orderly or not organized can edit $a1, $a2, $a3, etc. ( hand )

there nothing wrong lists or arrays...

but you're asking this:

eval "puts \$a$b" 

but still, list meant task, use it.

edit: seems right way is:

puts [set a$b] 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -