I'm having this simple code below, the file serverlist has a list of IPs one per line. When executed the while loop is executed only once, after that the program terminates. How should i redirect the exit status, so that the entire list of IP will get executed?
You're reading standard input from a file, which telnet closes when it's finished.
In ssh, for example, there's the -n option to get around this, but I couldn't see any equivalent telnet option, so instead, read the file from a different descriptor.