Hallo!
Ich habe mir folgendes Script zum Autologin für telnet sessions geschrieben:
Code:
#!/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:
Code:
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?
Lesezeichen