I have a command such that
bar > /dev/null
and I want to know the exit status of bar. I read some posts su about ${PIPESTATUS[0]}
but this works when one pipes the output via |
and I can't make it work with >
instead.
What am I missing?
I have a command such that
and I want to know the exit status of bar. I read some posts su about $ What am I missing? |
|||
You can also access it's return code with
|
|||||
|
false > /dev/null
and see that only${PIPESTATUS[0]}
has a value and${PIPESTATUS[1]}
is null which says the entirebar > /dev/null
is a single command with no pipe involved. – Ramesh Jan 7 at 1:57