I looked at Exiting a pipeline if a former command fails but I'm looking for a more general solution to this problem:
chlist -q -v -m -r $sourcelist | \
grep '^USER:' | \
chlist -q -v -f - $superlist
the problem is if the first chlist fails than no input into the 2nd chlist is very bad indeed.
Is there any solution to stopping the 2nd chlist from running other than putting the output of the first one into a temp file and then checking the exit status (eg not using a pipeline at all)?
(sleep 1; touch foo) | ls foo; ls foo
– dave_thompson_085 Dec 04 '18 at 12:03||
still apply? – John Hascall Dec 04 '18 at 12:42a||b
must wait for a to complete before deciding whether to execute b. Try((sleep 5;false)||touch foo)|(ls foo;date +D%F.%T);stat -cS%y foo
and see the timestamp on foo (labelled S) is 5 seconds after the time displayed bydate
(labelled D) – dave_thompson_085 Dec 06 '18 at 16:42