Re: OT: tail -f | while read
On Thu, Sep 06, 2001 at 09:47:01PM +0200, Martin F Krafft wrote:
> also sprach John Patton (on Thu, 06 Sep 2001 02:33:01PM -0500):
> > I couldn't get a variation of that working either... but if
> > myprog is a perl script and is driven by the while(<>) loop,
> > then you should be able to just pipe the output of the grep
> > right into it, like so:
> > tail -f /var/log/syslog | grep something | myprog
> > I'm not sure if that can be done directly with a shell
> > script though.
> why not, what's the difference???
> and could someone give me a perl one-liner that takes each such line
> fed into its STDIN, and for each line, calls an external shell script
> with the entire line as argument?
You know what, not only did a 1 liner not work, but I tried
implimenting a perl wrapper to call a shell script, and that
didn't work either. I'm really pretty confused about that,
actually. There must be something going on with how bash (or
the system) handles nameless pipes that is causing grief
here... but I don't know what. Maybe the output is buffered
or something... if anybody has any thoughts on this I would
be interested in hearing it.
Meanwhile, you might try running it on the tcsh shell.
Otherwise you might just be better off writting a more
complicated script that does everything itself and is run
from cron every few minutes or so.
John Patton firstname.lastname@example.org
"Death: to stop sinning suddenly."