Hi,
I think that the father of this bash script (lrm?) is setting the action
of SIGPIPE to SIG_IGN, and then "cat" itself notice that and resets it
to a function printing that on stderr.
You can reproduce that reliably with the following (that doesn't call a
shell to execute "cat"):
$ perl -e '$SIG{"PIPE"} = "IGNORE"; exec "/bin/cat";' < /dev/zero | head -1c >
/dev/null
/bin/cat: write error: Broken pipe
$
In addition, bash resets signals in a child process to the values they
add upon entrance to the shell, thus adding:
trap - PIPE
before calling "cat" will *not* work:
$ perl -e '$SIG{"PIPE"} = "IGNORE"; exec "/bin/bash", "-c", "trap - PIPE;
/bin/cat";' < /dev/zero | head -1c > /dev/null
/bin/cat: write error: Broken pipe
$
I fear you need to modify the father :-( (or of course use another
scripting langage than bash).
> Only if do like this:
> cat /proc/fs/nfs/exports | grep -q "^${export_dir}[ ]"
> the error goes away.
When the stdin of "cat" is small it may finish writing *before* the exit
of the reader (grep in your case). That's why I use /dev/zero in my
tests.
--
[EMAIL PROTECTED], Tel: (33) 04 92 38 79 11, Bur: C112
INRIA Sophia, 2004, rte des Lucioles, B.P.93 - 06902 Sophia Antipolis Cedex
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/