Missing Link

Dave Higgins dave at just4.com
Sun May 30 21:38:25 PDT 2004


Maybe someone can help me fill in a missing link.

I'm working up a shell script (#! /bin/sh) to act as a cgi bridge to a 
SuperCard project that does the actual processing. I can get most of 
the data from the cgi request by way of printenv, but what I'm missing 
is the post arguments. With the Revolution CGI engine, and also in 
PERL, you grab the post args by reading STDIN for the number of 
characters of $CONTENT_LENGTH. What I need is the shell script 
equivalent to this PERL line:

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

I would image I would have to use setenv to set $buffer to the contents 
of what STDIN provides, but the syntax eludes me.

I'm certainly no shell script expert, and I'm learning this as I go 
along, so please have patience if I seem to miss some basics. I've 
checked dozens and dozens of shell script "how to" Web sites, which 
certainly did help to get started, but nobody seems to come close to 
covering this. They all seem to refer to STDIN as being keyboard input.

I have no problem switching to csh or tcsh if it's easier to do that 
way, too.

------------------

There is one other alternative method I'd like to try, but I doubt that 
it's available... Is there a way to "setenv" a global variable? What I 
mean by that is can I do some special type of "setenv cgiData [printenv 
+ STDIN data]" that can be read by another copy of shell? That could 
allow me to keep everything in memory and skip passing data to 
SuperCard by way of file writing/reading and applescripting (with 
osascript) altogether.

Thanks for any help provided.

Dave.



More information about the X-Unix mailing list