How to get return values from bash pipeline command?
Issue
The customer is running a pipeline command, when using "echo $?", only the return value of last command could be got, how to get the return value from the second command?
# df |awk '{print $5}' |grep /mnt 2>&1 | tee ./log; echo $?
1
Environment
Red Hat Enterprise Linux All Versions
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.