I have recently acquired a Technicolor 582n modem/router. Not a wonderful device, but it will have to do for a while....
It has a LED/switch which is supposed to indicate when wifi is active, and also allow wifi to be toggled on and off. Trouble is, the switch does nothing.
After a bi]t of research, I find I can switch wifi on and off by opening a telnet session and entering these commands:
wireless radio state = enabled
wireless radio state = disabled
It is a bit of a pain to go through the manual process of logging into the router, entering the relevant command and logging out again. So I looked for a few scripting examples and tried them. This is what I've come up with:
echo "wireless radio state = disabled"
) | telnet
All looks ok, but there is a problem - the commands being echoed are not followed by a newline. As a result, they all pile up on the username prompt and the script never completes the log in.
I guess I could install expect and use that, but it seems like huge overkill for what I'm trying to accomplish.
So, is there any way of making sure that the telnet server in the router sees a newline and goes on through the script? Or am I stuck using expect to complete the script?