How to run telnet inside a shell script and execute commands on a remote server?
I did not expect to install on my Solaris machine for security reasons. I also do not have the perl module installed net::telnet.
So using pending and perl, how can I do this?
I tried the following but did not work.
#!/usr/bin/sh
telnet 172.16.69.116 <<!
user
password
ls
exit
!
When I execute it, this is what I get:
> cat tel.sh
telnet 172.16.69.116 <<EOF
xxxxxx
xxxxxxxxx
ls
exit
EOF
> tel.sh
Trying 172.16.69.116...
Connected to 172.16.69.116.
Escape character is '^]'.
Connection to 172.16.69.116 closed by foreign host.
>
Vijay source
share