[Newlug] Linux batch script question
Mike Schwartz
mschw at athenet.net
Sat Apr 9 13:15:17 UTC 2011
Thanks, Ben! That's what I couldn't think of yesterday - piping the input to the script! I'll try that this morning...
Mike
> -----Original Message-----
> From: newlug-bounces at newlug.org [mailto:newlug-bounces at newlug.org]
> On Behalf Of Ben DuPont
> Sent: Friday, April 08, 2011 7:14 PM
> To: newlug at newlug.org
> Subject: Re: [Newlug] Linux batch script question
>
> Like others have mentioned, a CGI program looks for POST data on stdin.
> That's why the script is hanging. Try this:
>
> echo "ctlrec=749&ctlval=3556&tcode=+4617780+&oldcrec=76149
> +&reference=INVO2233" | ./geninvo.cgi
>
> If that doesn't work, you might have to force an EOF character:
>
> echo -e "ctlrec=749&ctlval=3556&tcode=+4617780+&oldcrec=76149
> +&reference=INVO2233\0032" | ./geninvo.cgi
>
> You might also have to add the -n option to remove the new line character.
>
> Ben
>
> On Fri, 2011-04-08 at 09:39 -0500, Mike Schwartz wrote:
> > I’m trying to debug a script that is called from a web site and
> > spits back a .PDF file after the user clicks on the invoice number he
> > wants to see.
> >
> >
> >
> > The following script, named genpod.cgi, is on a Linux box and is
> > supposed to be able to be run from the command line after setting
> > QUERY_STRING to the following value:
> >
> >
> >
> > mike:> export QUERY_STRING=’ctlrec=749&ctlval=3556&tcode=+4617780
> > +&oldcrec=76149+&reference=INVO2233’
> >
> >
> >
> > mike:> ./geninvo.cgi
> >
> >
> >
> > However, the script seems to hang up at the “cat >$FPWP2” line.
> > It never creates the .out, .err, etc. output files.
> >
> >
> >
> > My question is: what is the “cat” command actually
> > concatenating at this point? Is it expecting another $1 parameter
> > after the ./geninvo.cgi command?
> >
> >
> >
> > Thanks!
> >
> >
> >
> > Mike Schwartz
> >
> >
> >
> > ----- ----- ----------------------------------
> >
> > #!/bin/sh
> >
> >
> >
> > umask 0
> >
> >
> >
> > FPWSYS=$$
> >
> > FPWP2=/tmp/fpwp2.$$
> >
> > export FPWSYS FPWP2
> >
> >
> >
> > . ./setglobal.bat
> >
> >
> >
> > cat > $FPWP2
> >
> > echo >> $FPWP2
> >
> >
> >
> > > /fpmerge/$$.out
> >
> > > /fpmerge/$$.err
> >
> > > /fpmerge/$$.frm
> >
> > > /fpmerge/$$.pcl
> >
> > > /ptmp/${FPWSYS}.pdf
> >
> >
> >
> > ############# main ##
> >
> > (other commands snipped…)
> >
> >
More information about the Newlug
mailing list