[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Random "Broken Pipe"



Marcelo E. Magallón <mmagallo@efis.ucr.ac.cr> writes:

> [79 jacinta:~] while true ; do echo -n . ; /usr/sbin/update-alternatives
> --display WindowMaker | grep -q 'WindowMaker-newstyle' ; done
> .....Broken pipe

>From the grep man page:

       -q, --quiet
              Quiet; suppress normal output.  The  scanning  will
              stop on the first match.

If grep exits (because it found a match) before update-alternatives is
finished writing to the pipe, then update-alternatives will receive a
SIGPIPE signal, and the shell will print "Broken pipe" after
update-alternatives crashes.

You can see this easily with something like `cat /dev/zero | true'.
(true doesn't read any input before it exits.)

> do you see a problem with the statement?

This is how it's supposed to work.  Can someone else suggest a way to
suppress the messages?

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	  GNU GPL: "The Source will be with you... always."


--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: