The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
returning to the parent shell after invoking a script within a script gurukottur Shell Programming and Scripting 5 09-26-2006 07:05 AM
Invoking Shell Script via php bubeshj Shell Programming and Scripting 2 06-30-2006 06:09 AM
Invoking shell script from html/jsp page bubeshj Shell Programming and Scripting 2 06-28-2006 01:53 PM
invoking one shell script from other ajay xavier Shell Programming and Scripting 3 05-24-2006 03:39 AM
How to run unix commands in a new shell inside a shell script? hkapil Shell Programming and Scripting 2 01-04-2006 06:56 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-07-2008
smriti_shridhar smriti_shridhar is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 47
Smile invoking a shell script inside cgi shell script

Hi,
I have an HTML form through which I get some text as input. i need to run a shell script say script.sh inside a perl-cgi script named main_cgi.sh on the form input.
I want to write the contents of the form in a file and then perform some command line operations like grep, cat on the text and thn output the result as HTML.

I am not able to find out what's gone wrong with the script. I am not able to write the text in the file and also the script.sh is not working.

The scripts are as following -

#!/bin/sh
# main_cgi.sh

eval `proccgi.sh $*`

echo "Content-type: text/html"
echo
echo "<HTML>"
echo "<BODY>"
echo "<center>"
echo "<H1>Results </H1>"
echo "$FORM_seqinput" |tr '\015' '\012' >file_1
echo "<br><br><H3><fontcolor = #800000>"
echo " 'cat file_1' "
./script.sh
if test -s res.out
then
echo "<br><br><H2><fontcolor = #000080>"
echo " 'cat res.out' "
fi
echo "</font></H3><br>"
echo "</center>"
echo "</BODY>"
echo "</HTML>"


#!/bin/sh
# script.sh
cat file_1 | wc -l >res.out

I will be thankful for your suggestions.

Smriti
  #2 (permalink)  
Old 07-07-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Have you tried using the full path to script.sh instead of ./?

I presume you've made sure that the file is executable the user that owns Apache?
  #3 (permalink)  
Old 07-09-2008
smriti_shridhar smriti_shridhar is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 47
Thanx!

Thanks! it worked.

smriti
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0