[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
unexpected behavior
From: |
Christof Warlich |
Subject: |
unexpected behavior |
Date: |
Thu, 12 Jan 2023 18:24:11 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
Hi,
can anyone explain why the following line prints 0 instead of 1?:
$ stat=0; false || echo hi && echo ho && stat=1 | tee /dev/null; echo $stat
hi
ho
0
It does what I'd expect when removing the pipe, so it's obviously caused
by some pipe magic going on ...:
$ stat=0; false || echo hi && echo ho && stat=1; echo $stat
hi
ho
1
Thanks,
Chris
- unexpected behavior,
Christof Warlich <=