Hi folks,
just by searching here I've found this script, which automates a telnet connection to a host:
#!/bin/sh
host=10.0.0.1
port=23
pass=xxxx
cmd1=24
cmd2=4
cmd3=21
( echo open ${host} ${port}
sleep 1
echo -e "\r"
sleep 1
echo ${pass}
sleep 1
echo -e "\r"
sleep 1
echo ${cmd1}
sleep 1
echo -e "\r"
sleep 1
echo ${cmd2}
sleep 1
echo -e "\r"
sleep 1
echo ${cmd3}
sleep 1
echo -e "\r"
sleep 1
echo exit ) | telnet host
I have also checked and it runs
, but I donīt understand how
, I mean what I see are some commands which output goes to the telnet application through a pipe, but when I run the script it seems as the telnet was executing first instead of the group of the commands before te pipe (echo and sleep commands).
Any feedback about this will be welcome.
Thanks in advance.
Jose.