LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 04-25-2007, 01:40 AM   #1
gjagadish
Member
 
Registered: Oct 2005
Location: India
Distribution: Fedora Core
Posts: 88

Rep: Reputation: 15
Disable Echo Mode in Expect Script


Dear Friends,

I'm using expect script for telnet. It works fine. But it echoes back the Password, which i send. I need to disable that echo. Here is my script

-----test1.sh---------------
#!/bin/sh
spawn telnet localhost 4212
expect "Password:"
exp_send "admin\n"
expect ">"
exp_send "del all\r"
expect ">"
exp_send "save /root/vod/vlcconf\r"
expect ">"
exp_send "exit\r"
expect ">"
----------------------------

Following is the result of my script

------------------------------
[root@front-end ~]# expect -f test1.sh
spawn telnet localhost 4212
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
Password:admin

Welcome, Master
> del all

> save /root/vod/vlcconf

> exit
Connection closed by foreign host.
[root@front-end ~]#
------------------------------

In the above result, i want my password (i.e. admin) not to be displayed.

pls help me
 
Old 04-25-2007, 09:09 AM   #2
reverse
Member
 
Registered: Apr 2007
Distribution: Gentoo
Posts: 337

Rep: Reputation: 30
I'm not familiar with Expect, but their documents seem promising. However, if you need security .. do you think telnet is a good choice?
 
Old 04-25-2007, 03:28 PM   #3
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
I'm not sure if there's a way to null specific output...I know when my dad writes his Expect scripts for server maintenance, there's next to no output. Try adding "log 0" up near the top of your script.
 
  


Reply



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
disable sleep mode, away mode standby, etc. ZiGz Linux - General 4 06-19-2016 01:15 PM
CGI script problem: Send/Expect command echo on webpage rajatgarg Programming 2 07-11-2004 04:38 PM
HowTo disable LCP echo request fransemail Linux - Software 2 05-04-2004 03:08 PM
expect scripting syntax problems...(catch, echo,....) wedgeworth Linux - Software 2 10-02-2003 09:24 AM
File Manager SU mode using expect Allen614 Programming 0 02-26-2003 01:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:25 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration