[wplug] Line-by-line input from stdin, from a bash script ?

Pat Barron pat at lectroid.com
Mon Oct 14 13:09:56 EDT 2013


On 10/14/2013 12:56 PM, G.Pitman wrote:
> Not sure I understand your goal entirely but would a fifo work?

Kind of a long story...  But in short, when the script is invoked, it's 
stdin is going to be attached to a socket, and the script is fired off 
from xinetd.  (And, of course, stdout is a network connection too...)

What I want to do is basically:

1)  Read line from stdin (which is really a network connection)
2)  Do something with it
3)  Repeat as necessary...

Of course, what I "do with it" in step 2 (and what happens next...) 
depends on what is previously read.  I have found (by experimentation) 
that I can't just read stdin until end of file and then process 
everything in one go, because the other side doesn't actually close the 
connection until it's told do so, so that just hangs forever, waiting 
for further instructions....)

I'll tell you exactly what I'm doing, so you can all laugh at me... 
(This is strictly a hobby project at the moment, it doesn't have to make 
sense...)  I'm trying to implement a (reasonably complete) web server in 
shell scripts....

--Pat.



More information about the wplug mailing list