Am bit new to Shell scripting, I've used some scripts using expect shell to logon to a router, But in my current organization i don't have the package is get installed and do not have the permission to do install also.
Can anyone please suggest me a way how to write a script to log-on into a cisco router without using "expect" in shell script.
I need to do a script using telnet by passing the host IP address as command line input with hard coded credentials in script as we have different set of routers with same credentials
. telnetpass.sh | telnet
(1031):> . telnetpass.sh | telnet
telnet> Trying 192.168.100.10...
Connected to test001.your.company.com (192.168.100.10).
Escape character is '^]'.
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Kernel 2.6.18-194.el5 on an x86_64
login: admin
Password:
Last login: Sun Sep 23 10:57:56 from test008.your.company.com
+------------- test001.your.company.com -------------+
:: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
:: 2.6.18-194.el5
:: 192.168.100.10
:: Image deployment date
:: 2011-Nov-22 ... 15:58:33
date;hostname;hostname -i
[admin@hdtest001 ~]$ date;hostname;hostname -i
Thu Sep 27 13:55:01 PDT 2012
test001.your.company.com
192.168.100.10
[admin@test001 ~]$ Connection closed by foreign host.
(1032):>