|
From: | Paul Wagner |
Subject: | Re: [Help-bash] When pipes fail (and when not) |
Date: | Thu, 06 Dec 2018 09:22:59 +0100 |
User-agent: | Posteo Webmail |
Dear Bashers,after leaving me with sleepless nights, yesterday the following solution to the problem that if SIGPIPE is caught in the enclosing environment,
for i in {0..9}; do echo $i; sleep 1; done | dd bs=1 count=10 does not terminate after '5', came to me:{ echo $BASHPID; for i in {0..9}; do echo $i; sleep 1; done; } | { read pid; dd bs=1 count=10; kill -s term $pid; }
Being aware that this might be a really ugly solution, I'd appreciate any comments or improvements on it.
Regards, Paul
[Prev in Thread] | Current Thread | [Next in Thread] |