expect scripting need help

Hi experts,

I am trying to develop a script using Expect. I am stuck somewhere. I need ur help guys.

I have sun solaris where i need to input the following commands-

bash-2.05$ telnet 11.13.58.39 2310
Trying 0.0.0.0...
Connected to ..
Escape character is '^]'.
CONNECTING TO...

PROCESS 2310 CONNECTED...

Enter command: LOGIN:user1:passwd1;
RESP:0;
Enter command: GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
RESP:0:Profile,01:MSI,987012365875:RIM,987012365875
Enter command: LOGOUT;
RESP:0;
Enter command: Connection to . closed by foreign host.
$

Now i want to made a ineterface for someusers in my solaris. The user will enjoy their own interface. To do this I changed the .profile of a username "john". And when john login he will see-

root@ircemaprod # su - john
Sun Microsystems Inc. SunOS 5.9 Generic May 2002
----------Welcome to Command Interface----------

Enter Command or type EXIT to exit
GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
RESP:0:Profile,01:MSI,987012365875:RIM,987012365875;
Enter command:

Enter Command or type EXIT to exit
EXIT

Now u see "command" comes twice. and "Enter command" prompt comes again. I don't want see those redcolor in my interface. How to do dear experts?? Please let me know if you need more info from me ?

Attached is .profile for user john and and expect script--
#!/usr/local/bin/expect -f

set timeout 180
set server [lindex $argv 0]
set ip [lindex $argv 1]
set user [lindex $argv 2]
set passwd [lindex $argv 3]
set cmd [lindex $argv 4]

log_user 0

spawn telnet $server $ip

expect "command: "
send "LOGIN:$user:$passwd;\r"

expect "command: "
log_user 1
send "$cmd\r"

expect "command: "
send "LOGOUT;\r"

exit

I don't really understand your question, could you make things easier for us to understand ?

Here is it-

I have unix server where i have a application for some special commands. Below way to entering in that application-

bash-2.05$ telnet 11.13.58.39 2310
Trying 0.0.0.0...
Connected to ..
Escape character is '^]'.
CONNECTING TO...

PROCESS 2310 CONNECTED...

Enter command: LOGIN:user1:passwd1;
RESP:0;
Enter command: GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
RESP:0:Profile,01:MSI,987012365875:RIM,987012365875
Enter command: LOGOUT;
RESP:0;
Enter command: Connection to . closed by foreign host.
$

Now i want to make a ineterface for a user "john" in same machine where . User "john" will use the below ineterface. In fact, below ineterface will directly ineterct with above green colored ineterface. Whatever the command "john" will put the below ineterface- command will go to above mentioned application and show the response-

root@ircemaprod # su - john
Sun Microsystems Inc. SunOS 5.9 Generic May 2002
----------Welcome to Command Interface----------

Enter Command or type EXIT to exit
GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
GET:SUBSCRIBERINFORMATION:SubscriberNumber,012365875;
RESP:0:Profile,01:MSI,987012365875:RIM,987012365875;
Enter command:

Enter Command or type EXIT to exit
EXIT

Now u see "command" comes twice. and "Enter command" prompt comes again. I don't want see those redcolor in my interface.

Can any one suggest me, How can I start write scripts to test IPV6 features