Telnet using shell script

Hi
I need to telnet a device with IP Address and port. After logging in, I need to execute some commands in that device. Please find the example below

telnet 170.10.11.1 2100 #170.10.11.1 is the IP address. 2100 is the Port

after telnet, the device will show the command prompt as :

#-1,'Empty Line'

I need to enter the below command after this line :

show equip slt() # this is my command. after this command i need to exit.

quit() # this command is to exit from the telnet device

Can any one help me out for this using shell script?

You can use expect for this . here is a sample

#!/usr/bin/expect

spawn telnet 170.10.11.1 2100
  expect "login:"  
  send username\r
  expect "password:"
  send password\r
  expect "$"  
  send "touch filetest\r"
  expect "$"  
  send exit\r
  expect eof

Thanks for your help. IT works fine successfully.

---------- Post updated at 01:51 AM ---------- Previous update was at 01:48 AM ----------

I have telnet to a machine and executed some commands in it.
pls see below :

#!/usr/bin/expect

spawn telnet 170.10.11.1 2100
expect "login:"
send username\r
expect "password:"
send password\r
expect "$"
send "touch filetest\r"
expect "$"
send exit\r
expect eof
But after this, I am executing some shell commands "echo". it throws

invalid command name "echo"
while executing

Can anyone help me out in this case?