zsh-users
 help / color / mirror / code / Atom feed
From: Sweth Chandramouli <sweth@astaroth.nit.gwu.edu>
To: ZSH Users <zsh-users@math.gatech.edu>
Subject: Re: Re: easy way to read from stdin ?
Date: Tue, 23 Jun 1998 18:42:23 -0400	[thread overview]
Message-ID: <19980623184223.11524@astaroth.nit.gwu.edu> (raw)
In-Reply-To: <980623150145.ZM1264@candle.brasslantern.com>

On Tue, Jun 23, 1998 at 03:01:45PM -0700, Bart Schaefer wrote:
> On Jun 23,  4:37pm, Sweth Chandramouli wrote:
> } Subject: easy way to read from stdin ?
> }
> } 	this is probably just going to show my colossal cluelessness, but is 
> } there an easy way to get a zsh script to read from standard input?
> 
> It should be reading everything except the commands themselves from the
> standard input "by default."  However, I'm puzzled when you say:
> 
> } ... rather than reading input from a file ...
> 
> What is it that you are doing to cause it to read from a file?  That is,
> when it's not a cgi, how do you run it?
	i put a "< filename" after the while read loop, so that it would
read input from the file "filename".  basically, i'm trying to create a
mailto form here--it should take the values from the form in question,
do some processing on them, return a web page indicating success or
failure, and mail the results off to someone using mailx.  the processing
i was trying to do is the same as what i was doing elsewhere using an
already-existing script, so i figured that if i could just cut&paste
that script into my new cgi form, and remove the redirection of stdin
from a file, everything would work fine.  it _does_ work fine from the
command line (e.g. "echo 'testing' | myscript.cgi" does what i expect),
but when i run it as a form, it acts as though it is getting no input.
	i do know that the input is, in fact, getting through to the
script, however, because i tried replacing my script with a little perl
snippet i found elsewhere that basically pumps stdin into a variable and
then prints it to screen, and that worked fine.  i don't really have the
time or patience right now to do what i should do, and actually learn
perl, so i was hoping that there was some subtle point about stdin for
a shell script that i was missing.
	if no one else has any ideas, i'll probably wander over to the
perl newsgroups and see if anyone can explain exactly what that perl
snippet that i stole is doing, to see if maybe i'm not understanding
it correctly.  (i should probably do that regardless, i guess...)

	-- sweth.

-- 
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


  reply	other threads:[~1998-06-23 22:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-23 20:37 Sweth Chandramouli
1998-06-23 22:01 ` Bart Schaefer
1998-06-23 22:42   ` Sweth Chandramouli [this message]
1998-06-23 23:50     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19980623184223.11524@astaroth.nit.gwu.edu \
    --to=sweth@astaroth.nit.gwu.edu \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).