Open telnet and send commands on a single bash line
by pedropt from LinuxQuestions.org on (#4VHQS)
I am trying to execute a mail read using telnet on pop3 port , however i did not had any luck .
My objective is to connect with telnet using a line in bash , get all the stats from specific username to a file .
Code:#!/bin/bash
user="USER someuser@someserver"
pass="PASS password"
server="mailserver"
port="110"
telnet $server $port | sleep 1 | echo $user | sleep 1 | echo $pass | sleep 1 | echo STATS | echo QUIT > file >/dev/null 2>&1
echo "Done"
exit 0Ideas ?


My objective is to connect with telnet using a line in bash , get all the stats from specific username to a file .
Code:#!/bin/bash
user="USER someuser@someserver"
pass="PASS password"
server="mailserver"
port="110"
telnet $server $port | sleep 1 | echo $user | sleep 1 | echo $pass | sleep 1 | echo STATS | echo QUIT > file >/dev/null 2>&1
echo "Done"
exit 0Ideas ?