LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-11-2004, 03:34 PM   #1
rajatgarg
Member
 
Registered: Oct 2003
Posts: 41

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


Hi,

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.....

Regards,
Rajat Garg
Student
Stanford University
 
Old 07-11-2004, 04:15 PM   #2
born4linux
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 google.com/linux.
 
Old 07-11-2004, 04:38 PM   #3
jovo
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";
}
 
  


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
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

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

All times are GMT -5. The time now is 06:44 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