Suppressing output of a spawned telnet process

Hi,

I'm trying to spawn a telnet process and trying to do some actions in the remote host using expect script. I would like to know how to suppress all the output in order the user using the script should not be able to see any actions done on the remote host. I tried using the "log_user 0" which only suppresses the output of the spawned process but the actions performed on the remote host is still being displayed.

Thanks,
Arun Venktesh.V

Could you post a small script that reproduces this behavior?

In the below sample code I wanted the action "date" not shown to the user.

#! /usr/local/bin/expect --

set timeout 120
log_user 0

spawn telnet <hostname>

expect "login: $"
send " username\r"
expect "Password: $"
send "password\r"

expect "<prompt> $"
send "date\r"

expect "<prompt> $"
send "exit\r"

interact

The only output I get is:

exit
Connection closed by foreign host.

expect version 5.44.1.15

Hi Radoulov,

Are you not getting the output of date command on the terminal ?

No. I'm getting only:

exit
Connection closed by foreign host.

What OS are you using?

I'm using AIX and this is the output I'm getting

date
exit
Tue Jun 29 06:45:40 EDT 2010
<Hostname>exit
Connection closed.

Sorry, I don't have access to an AIX machine right now.
I tested it with Solaris, Linux and Cygwin and it works as expected.

Thanks for your efforts...