# creation script de configuration de la matrice par ligne de commande
# ============================================================================
+# get matrix ip
+set ip ""
+set fid [open "/etc/hosts" r]
+while { [gets $fid line] >= 0 } {
+ regsub "#.*$" $line {} line
+ if {[string match "*matrix*" $line]} {
+ regsub -all "\\." $line " " line
+ foreach word $line {
+ if {![regexp "^\[0-9\]+$" $word]} break
+ set digit [format "%03d" $word]
+ set ip [concat $ip $digit]
+ }
+ break
+ }
+}
+close $fid
+set matrix [join $ip "."]
+
spawn /opt/trc6500/tools/matrix_tool
set timeout 3
"taper la commande choisie" { send "10\r" }
}
-expect "nouvelle adresse" { send "010.133.026.253\r" }
+expect "nouvelle adresse" { send "$matrix\r" }
expect "taper la commande choisie" { send "12\r" }