43 cards
View
Linked contentRepeats
Claus-Theodor Riegg
3 years
Repeats
Claus-Theodor Riegg
1 year
Andreas Herz
1 year
Linked content
Claus-Theodor Riegg
2 years
Claus-Theodor Riegg
2 years
Claus-Theodor Riegg
2 years
Claus-Theodor Riegg
3 years
Linked content
Marius Schuller
3 years
Claus-Theodor Riegg
3 years
Claus-Theodor Riegg
3 years
Linked content
Claus-Theodor Riegg
3 years
Claus-Theodor Riegg
3 years
Posted about 4 years ago. Visible to the public. Linked content.

Bash: Find out the exit codes of all piped commands

Bash stores the exitcodestatus of piped commands in the environment variable PIPESTATUS

So you can just echo ${PIPESTATUS[@]} to get them all.

Copy
13:52:30 ✔ claus:~$ ps ax | grep /usr/bin/ruby 13205 pts/20 S+ 0:00 grep --color=auto /usr/bin/ruby 13:52:43 ✔ claus:~$ echo ${PIPESTATUS[@]} 0 0

PIPESTATUS is an array, so you can get the exitcode of an specific command (first pipe):

Copy
13:54:20 ✔ claus:~$ echo ${PIPESTATUS[1]} 0

Owner of this card:

Avatar
Claus-Theodor Riegg
Last edit:
about 4 years ago
by Claus-Theodor Riegg
Keywords:
ops
This website uses cookies to improve usability and analyze traffic.
Accept or learn more