*BSD News Article 91007


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!metro!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!cpk-news-hub1.bbnplanet.com!su-news-hub1.bbnplanet.com!news.bbnplanet.com!pacbell.com!amdahl.com!amd!canntp.amd.com!txnntp.amd.com!news2.amd.com!uuneo.neosoft.com!not-for-mail
From: conrads@neosoft.com (Conrad Sabatier)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: A shell oddity (bug?)
Date: Tue, 11 Mar 1997 00:23:47 -0600
Organization: NeoSoft, Inc.
Lines: 28
Message-ID: <jpt2g5.q2c.ln@dolphin.neosoft.com>
Reply-To: conrads@neosoft.com
NNTP-Posting-Host: 206.27.167.0
X-Newsposter: Pnews 4.0-test53 (3 Feb 97)
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:37009


While fooling around tonight, trying to find a way to "lock" a
program so multiple instances of it wouldn't be spawned by cron
(I later discovered "lockfile"), I noticed something kind of strange.
In both csh and sh (didn't try any others), the following pipeline
produces some unexpected results:

ps -xU news | grep fetch

Assuming there's a running /usr/local/sbin/fetch (part of the
leafnode package), then all one *should* see as a result would be:

<PID> .... /usr/local/sbin/fetch

However, sometimes the "grep fetch" itself also appears in the
output!

This makes no sense to me.  Grep should be receiving the piped
output of ps taken from *before* grep was running.

Why does this happen?

Conrad, still intending to whip that leafnode port into shape (I've
been busy!)
-- 
Conrad Sabatier		http://www.neosoft.com/~conrads