how to get the exit status of the first command in a pipe?


This question already has an answer here:


Use the PIPESTATUS array:

$ ls foo | cat
ls: foo: No such file or directory
$ echo ${PIPESTATUS[0]} ${PIPESTATUS[1]}
2 0

Note: PIPESTATUS is a bashism (i.e. not POSIX).

Need Your Help

Should 'if' statement always have an 'else' clause?


This may be a religious argument, but it has been debated ad-nauseum here at my work whether all IF statements should include an ELSE clause - even if the ELSE clause only contains a comment statin...

Where can I set proxy for SBT in Intellij IDEA?

scala intellij-idea proxy sbt

I am using Intellij IDEA 14.1.3 edition and have installed Scala plugin. When creating SBT project, it reports the following error: