Extending sed's exit codes functionality
Garrett Cooper
yanegomi at gmail.com
Mon Apr 4 22:28:49 UTC 2011
On Mon, Apr 4, 2011 at 9:25 AM, <rank1seeker at 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
More information about the freebsd-hackers
mailing list