darktemplaaa
12-01-2012, 12:50
Hallo!
Ich habe mir folgendes Script zum Autologin für telnet sessions geschrieben:
#!/bin/bash
for host in `cat /root/telnet-script/hosts.txt` ; do
expect << EOF
spawn telnet $host
expect "username: "
send "USERNAME\r"
expect "password: "
send "SicheresPasswort\r"
expect -exact "-->"
send "users\r"
expect -exact "-->"
send "exit\r"
EOF
done;
ich möchte mir nun aber einige Rückgabewerte in eine Textdatei pipen z.B. alle user:
send "users\r" >> /root/users.txt
Nur klappt das ja leider so nicht weil ich noch in der expect Schleife bin. Hat einer eine Idee wie ich das trotzdem exportiert bekomme?
Ich habe mir folgendes Script zum Autologin für telnet sessions geschrieben:
#!/bin/bash
for host in `cat /root/telnet-script/hosts.txt` ; do
expect << EOF
spawn telnet $host
expect "username: "
send "USERNAME\r"
expect "password: "
send "SicheresPasswort\r"
expect -exact "-->"
send "users\r"
expect -exact "-->"
send "exit\r"
EOF
done;
ich möchte mir nun aber einige Rückgabewerte in eine Textdatei pipen z.B. alle user:
send "users\r" >> /root/users.txt
Nur klappt das ja leider so nicht weil ich noch in der expect Schleife bin. Hat einer eine Idee wie ich das trotzdem exportiert bekomme?