[Newlug] Linux batch script question
Ben DuPont
ben at nebland.com
Sat Apr 9 00:13:56 UTC 2011
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