help-bash
[Top][All Lists]
Advanced

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

[Help-bash] When pipes fail (and when not)


From: Paul-Jürgen Wagner
Subject: [Help-bash] When pipes fail (and when not)
Date: Mon, 05 Nov 2018 17:33:23 +0100
User-agent: Posteo Webmail

Dear Bashers,

I have the following script:

for i in {0..9}; do echo $i; sleep 1; done | tee foo | dd bs=1 count=10

When I execute it on a Linux box (bash version 4.2.45(2)), the whole pipe writes

0
1
2
3
4

to foo, prints the same on the terminal, and exits as expected. Same behaviour occurs on Cygwin (bash 4.4.12(3)). But when I run this in a GNURoot on an android tablet (bash 4.3.30(1)), I get

0
1
2
3
4
5
6
7
8
9

in file foo and

0
1
2
3
4
tee: standard output: Broken pipe
tee: write error

on the terminal. Apparently the broken pipe does not cause the whole pipe to quit. Could anyone explain why? My script relies on the last command being able to terminate the whole pipe. Is there a way to ensure this behaviour on GNURoot (android)?

Kind regards,

Paul

P.S.: I noticed that with GNURoot on android, process substitution does not work, probably because /dev can not be written? Is that related to the problem above?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]