From: Laurent Mazet Date: Mon, 21 Sep 2015 12:55:08 +0000 (+0200) Subject: configure_matrix get matrix ip from /etc/hosts X-Git-Tag: debian_7.8.6~10 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=1dbdd42056c2268a47cc0d0b1c609ce2021a6d6b;hp=2d6251dfa495072b2f84e94be4dad2c6538a4896;p=debian6500.git configure_matrix get matrix ip from /etc/hosts --- diff --git a/master/opt/script/configure_matrix b/master/opt/script/configure_matrix index 540c3d1..976890b 100755 --- a/master/opt/script/configure_matrix +++ b/master/opt/script/configure_matrix @@ -8,6 +8,24 @@ # 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 @@ -29,7 +47,7 @@ expect { "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" }