set fid [open ./hosts r]
set content [read $fid]
close $fid
## Split into records on newlines
set records [split $content "\n"]
send "records splited\n"
send $records\n
set a "test\n"
send $a
foreach rec $records {
## Split into fields on colons
set fields [split $rec "\n"]
#set fields [split $records "\n"]
puts $fields
for {set x 1} {$x < 4} {incr x} {
spawn ssh root@$fields
expect "*yes/no*" { send "yes\r"}
expect "*password:*" { send "redhat\r" }
expect "*#*" { send "exit\r" }
expect eof
puts "$a"
}
}
...and is there a question, comments or just a code dump waiting for a miraculous response answering your unexplained issue?
1 Like