Good afternoon! Please tell me. The idea of the script is that it enters the switch, displays the values and redirects them to another file. Wrote like this:
(
echo "$username"
sleep 2
echo "$Pass"
sleep 2
echo "show ..." >> /home/...
sleep 2
echo "logout"
) | telnet 172.20...
But here, again, the problem is that it writes a command to the file, that is, echo simply displays it in text, and as a result, in the file "show .." Is it possible that it writes to the file exactly the results of the command on the switch, for example, the status of the ports
implemented via screen -L
It works, writes information to a file, but it works very unstable, so let's say, you run the script
show ports.
And he writes the result of this command (state) 2 or 3 times to the file. That is, it simply duplicates the same information many times. Although the script was run once and executed once