Xun Sun wrote:
On 1/12/06, Peter Kruse <[EMAIL PROTECTED]> wrote:
Hello,

In one of my RAs there is a line like this:

( exportfs ; cat /proc/fs/nfs/exports ) | grep -q "^${export_dir}[   ]"

This line apparently produces these errors:

Jan 12 13:40:08 ha-test-1 lrmd: [16217]: info: RA output:
(rg1:nfs1:monitor:stderr) cat:
Jan 12 13:40:08 ha-test-1 lrmd: [16217]: info: RA output:
(rg1:nfs1:monitor:stderr) write error
Jan 12 13:40:08 ha-test-1 lrmd: [16217]: info: RA output:
(rg1:nfs1:monitor:stderr) : Broken pipe

Can anybody give me a hint what am I doing wrong with the above?


I guess it's a shell specific behavior. If you are using Bash, I would
suggest removing the subshell construct.

No. This is a property of the -q option, and is normal behavior if you specify the -q flag.

It's always good to read the man pages for commands when you see weird things happen.

   -q, --quiet, --silent
      Quiet;  do  not write anything to standard output.  Exit immedi‐
      ately with zero status if any match is found, even if  an  error
      was detected.  Also see the -s or --no-messages option.


The key phrase is "exit immediately ... if any match is found". So, it exits. Then cat dies with "broken pipe, because you told grep to exit immediately after any match. And, of course, he _can't_ remove the subshell construct from his code - that's what makes it work!



--
    Alan Robertson <[EMAIL PROTECTED]>

"Openness is the foundation and preservative of friendship... Let me claim from you at all times your undisguised opinions." - William Wilberforce
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to