Get exit code from subshell through the pipes
问题 How can I get exit code of wget from the subshell process? So, main problem is that $? is equal 0. Where can $?=8 be founded? $> OUT=$( wget -q "http://budueba.com/net" | tee -a "file.txt" ); echo "$?" 0 It works without tee , actually. $> OUT=$( wget -q "http://budueba.com/net" ); echo "$?" 8 But ${PIPESTATUS} array (I'm not sure it's related to that case) also does not contain that value. $> OUT=$( wget -q "http://budueba.com/net" | tee -a "file.txt" ); echo "${PIPESTATUS[1]}" $> OUT=$(