Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Apr 2011 15:28:48 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        rank1seeker@gmail.com
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Extending sed's exit codes functionality
Message-ID:  <BANLkTi=dk%2B30p2JizsGgH0bGDc5nQaMkkw@mail.gmail.com>
In-Reply-To: <20110404.162515.125.1@DEV>
References:  <20110404.162515.125.1@DEV>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 4, 2011 at 9:25 AM,  <rank1seeker@gmail.com> wrote:
> http://forums.freebsd.org/showthread.php?p=129996

    gordon@'s observation seems valid:
http://forums.freebsd.org/showpost.php?p=130007&postcount=2 ?
    Your other question about grep returning 141 was because it caught
SIGPIPE, so probably a *csh bug (I wouldn't be surprised).
    When in doubt, simplify (and don't use csh)!

$ csh -c "cat /sys/conf/NOTES | grep -m 1 '^device' /sys/conf/NOTES; echo \$?"
device          hwpmc                   # Driver (also a loadable module)
141
$ env ENV=/dev/null sh -c "cat /sys/conf/NOTES | grep -m 1 '^device'
/sys/conf/NOTES; echo \$?"
device          hwpmc                   # Driver (also a loadable module)
0

    You might want to ktrace/truss the piped process to figure out why
it's catching SIGPIPE, and maybe submit a bug report once you figure
out why csh isn't playing nicely.
    Happy hunting.
Thanks,
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTi=dk%2B30p2JizsGgH0bGDc5nQaMkkw>