tech-userlevel archive

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

rc of built-in printf



Is it on purpose that sh's (at least, NetBSD-8's sh's) built-in printf doesn't 
give a non-zero rc if the underlying write(2) fails (with EPIPE, in my case)?

It turns out that this

	{ sleep 1; printf "Hallo" || echo "ERROR">&2; } | echo Foo

doesn't print "ERROR" with both sh and bash, while it does with ksh.
Replacing printf with echo changes nothing, while using the /usr/bin
(or /bin, in case of echo) form does what I would expect.

kre?


Home | Main Index | Thread Index | Old Index