I am executing:
Command1 | tee >(grep sth) || Command2
I want Command2 to be executed based on the exit status of grep, while in the current configuration it is being executed based on the result of tee.
As far as I know pipefail and pipestatus are not working here (please correct me if I am wrong).
Modification to the Origian question based on Alexej Answer
I also tried Command1 | tee >(grep sth || Command2)
, which works for my original question, but as I am trying to set the status of my test in the subshell; ex, Command 1 | tee>(grep sth || Result="PASSED")
and later have access to the Result in other chunks of my code. So I still have problem.
Thanks