I have a modem which I need to reboot from a router. A modem accepts only telnet and has a Web GUI. If I telnet from the router manually, I can reboot the modem with no problem at all. But when I try to issue following at the router:(sleep 1; echo usr; sleep 1; echo pwd; sleep 5; echo reboot; ) | telnet 192.168.0.1it will log me in, show a prompt # at the router, but it will never do the third command. What am I doing wrong? For test purposes: I tried using ls instad of rebootI tried varying the sleep lengths I tried from a Raspberry Pi instead of from a routerbut I can never get a modem to accept and/or execute any command after a login using telnet this way.I have no expect available.  I would prefer to solve it using router's sh script as it already does several things there.
Remote telnet to reboot a modem not working
shell;scripting;telnet