I will also share that I’ve found the parray command usefull when working with arrays.
The parray command will list out the array index and value stored in that array location in sorted order.
For grins give this a try:
hcitcl
parray auto_index
Here is a script I downloaded that Charlie posted that uses the parray command to list out the contents of global arrays:
#!/usr/bin/ksh
# this line to escape the next line from the tcl interpreter
exec hcitcl “$0” “$@”
#——————————————————————————–
# Purpose:
#
# list out the value of all the globals
#
# History:
#
# 2008.12.29 Russ Ross
# – downloaded orignal copy of script posted by Charlie Brusell at URL
#
# http://clovertech.infor.com/viewtopic.php?t=3256
#
#——————————————————————————–
foreach glob [info globals] {
global $glob
# Is it an array?
if {[array exists $glob]} {
echo nThe values of global array $glob are:
parray $glob
continue
}
# It is not an array, make sure it exists
if {[info exists $glob]} {
echo nThe value of global variable $glob is: [set $glob]
} else {
echo nThe value of global variable $glob is: UNDEFINED
}
}
Russ Ross
RussRoss318@gmail.com