|
Problem with exit status
Hi,
Consider the output of the following commands:
case1)
-------
# ifconfig -a | grep "UP" | grep uplink0:1
# echo $?
Output is: 0
case2
------
# ifconfig -a | grep "UP" | grep uplink0:1; echo $?
Output is: 1
In case2 we got the exit code as 1, which is the actual exit code.
Why did we not get the actual exit code in case1?
What is the difference between executing two different command at the same time (as in case 2) and one after the other (as in case 1)? In both the cases the commands will get executed in the same sequence.
Any help will be highly appreciated.
Thanks.
|