Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 07-11-2004, 03:34 PM   #1
Registered: Oct 2003
Posts: 41

Rep: Reputation: 15
CGI script problem: Send/Expect command echo on webpage


I am writing a CGI script which calls a perl script to remotely login to a machine using send/expect commands. Problem is that all those messages get
printed on webpage. How to tackle these ?
Kindly let me know.....

Rajat Garg
Stanford University
Old 07-11-2004, 04:15 PM   #2
Senior Member
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
assuming that you are using Apache, look for "Apache CGI howto" via
Old 07-11-2004, 04:38 PM   #3
LQ Newbie
Registered: Jul 2003
Location: Amersfoort Netherlands
Distribution: SuSe 8.1
Posts: 8

Rep: Reputation: 0
Everything printed to stdout inside a CGI-script is sent to the browser. The browser tries to make something from it. I think you must do something like

my $reply=`MyExpectScript`;

Note: use backticks!!!!!

Now everything your script prints is put as a string in $reply.

So the next code will be

# do something with the data in $reply
print "..... the results you want to see....."

for instance if you just want to show all the lines on your screen

for my $line (split(/\n/,$reply)) {
print "$line<BR>\n";


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
Bash Script, no new line for echo command jorisb Linux - General 5 11-05-2005 12:08 AM
[Expect scripting] send problem ldp Programming 1 01-24-2005 02:39 PM
CGI Script runs to send mail, but mail is never sent robertwo Linux - Newbie 2 06-10-2004 09:57 AM
expect scripting syntax problems...(catch, echo,....) wedgeworth Linux - Software 2 10-02-2003 09:24 AM
writing a cgi to redirect to another webpage JustinHoMi Programming 2 09-28-2001 08:08 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:54 PM.

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