Answer the question
In order to leave comments, you need to log in
Modify a BASH script to give the output of a specific command?
I'm trying to extract the states of Mikrotik's Ethernet interfaces with a script:
#! /bin/bash
HOST=$1;
(
echo -en 'admin\r'; #логин
sleep 1;
echo -en 'admin\r'; #пароль
sleep 2;
echo -en 'interface ethernet print\r'; #информация об интерфесах
sleep 2;
echo -en 'quit\r'; #вышел с устройства
) | telnet $HOST >> tmp.txt #захожу телнетом и вывод работы скрипта сохраняю в файл
interface ethernet print
Answer the question
In order to leave comments, you need to log in
Don't use telnet. There is quite a normal api, well, or at least ssh.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question