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 09-19-2001, 12:42 PM   #1
JustinHoMi
Member
 
Registered: Apr 2001
Location: Raleigh, NC
Distribution: CentOS
Posts: 154

Rep: Reputation: 30
writing a cgi to redirect to another webpage


Hey folks. I don't know an ounce of perl, and my c is pretty weak, but I need to write a couple of cgis. So, my idea was that I could have a simple cgi that would call a shell script (something I can do! ) and then redirect to a webpage, say, mypage.html. I understand that I could use something like this (with perl) for the former:

@output = `/bin/sh /home/matt/scripts/script.sh`;

or

system("/bin/sh /home/matt/scripts/script.sh");


Now, script.sh is going to generate mypage.html, so I'd like the cgi to there. Is there a good and simple way to do this?

Any help would be greatly appreciated!

Thanks,
Justin
 
Old 09-28-2001, 07:22 PM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
Not that fully understand what you are asking, but here is cgi script writtin in sh that will do anything you want then redirect you somewhere else. This is untested.
Code:
#!/bin/sh

# do whatever

echo Content-type: text/html
echo

cat << EOF

<HTML>

<meta http-equiv="Refresh" content="1; url=http://www.cnn.com">

</HTML>
 
Old 09-28-2001, 08:08 PM   #3
JustinHoMi
Member
 
Registered: Apr 2001
Location: Raleigh, NC
Distribution: CentOS
Posts: 154

Original Poster
Rep: Reputation: 30
Oh, that works! I didn't realize you could use a shell script for a cgi. I had tried, but I guess I had mistyped something.

Thanks, even better than what I'd asked for!

Justin
 
  


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
Inserting cgi-scripts on my webpage @ngelot Programming 5 11-02-2004 03:11 PM
CGI to work out side of cgi-bin? crashedspine Linux - Newbie 13 09-02-2004 08:49 PM
CGI script problem: Send/Expect command echo on webpage rajatgarg Programming 2 07-11-2004 04:38 PM
cd writing software which supports multisession writing jayakrishnan Linux - General 3 03-24-2003 05:51 AM
http://www.burstnet.com/cgi-bin/ads/ad7954a.cgi/3980/RETURN-CODE rverlander LQ Suggestions & Feedback 1 06-07-2002 07:35 AM

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

All times are GMT -5. The time now is 02:16 PM.

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