I have following expect script, I need help to get uname -m variable and assign to if statement.
Thanks!
#!/usr/bin/expect
set USER [lindex $argv 0]
set USER_PASS [lindex $argv 1]
set fid [open /path/iplist.dat]
set contents [read -nonewline $fid]
close $fid
foreach IPADDR [split $contents "\n"] {
spawn ssh $USER@$IPADDR
expect {
"assword:" {
send "$USER_PASS\r"
}
"you sure you want to continue connecting " {
send "yes\r"
expect "assword:"
send "$USER_PASS\r"
}
}
# how do I get uname -m here #
if { ["$HVAR" = "A"] } {
do some action here
} else {
do some action here
}
}
expect eof
Thanks!
#!/usr/bin/expect
set USER [lindex $argv 0]
set USER_PASS [lindex $argv 1]
set fid [open /path/iplist.dat]
set contents [read -nonewline $fid]
close $fid
foreach IPADDR [split $contents "\n"] {
spawn ssh $USER@$IPADDR
expect {
"assword:" {
send "$USER_PASS\r"
}
"you sure you want to continue connecting " {
send "yes\r"
expect "assword:"
send "$USER_PASS\r"
}
}
# how do I get uname -m here #
if { ["$HVAR" = "A"] } {
do some action here
} else {
do some action here
}
}
expect eof