LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-05-2005, 03:51 PM   #1
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
expect question


I started working on my very first expect script and had a quick question. Basically, my script is just something I am using to use the TCPquery port of my TeamSpeak server to see if anyone is logged in. I've got the basic script working pretty well, but I wanted to change the output of it somewhat.

Reading the man page, it sounds like the expect command stty -echo is supposed to turn off echoing, but it doesn't seem to turn off echoing of any sort. For instance, if I have an expect script like so:

Code:
#!/usr/bin/expect -f
stty -echo
spawn telnet localhost 51234
expect "TS"
send "sel 8767\n"
expect {
    "OK" { send "login user password\n" }
    "ERROR" exit
}
expect {
    "OK"  { 
          stty echo
          send "pl\n" }
    "ERROR" exit
}
expect {
    "OK" {send "quit"}
    "ERROR" {send "quit"}
}
I get the following:

Code:
$ ./lsts2
spawn telnet localhost 51234
Trying 127.0.0.1...
Connected to localhost.

Escape character is '^]'.
[TS]
sel 8767
OK
login user password
OK
pl
p_id    c_id    ps      bs      pr      br      pl      ping    logintimeidletim
e       cprivs  pprivs  pflags  ip      nick    loginname
OK
I was hoping that turning off the echo would eliminate all output up until the user list info. Obviously it didn't do that, and didn't even stop it from echoing the comands that were sent. So my question is, is there another easy way to suppress the output of an expect script? Or am I using stty wrong? Will I need to capture the output into Tcl variables in order to do what I want?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possibly the dumbest question I would ever expect to ask pyrael Linux - General 9 11-22-2005 05:52 AM
A question about expect. imjoe Programming 1 10-26-2005 04:42 AM
expect question reitzell Programming 1 11-20-2004 09:03 AM
Double and single quote, Question in expect evilchild Programming 4 08-22-2004 05:34 PM
"expect" shell beginner question, please help me out yuzuohong Linux - General 1 06-28-2003 01:17 PM


All times are GMT -5. The time now is 07:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration