4 ms·
In bash, you can get the rc of piped things, the var eludes me while walking..
by bbarnett 5y ago
In bash, you can get the rc of piped things, the var eludes me while walking..
- dylan604 5y ago${PIPESTATUS[@]} for a space delimited list of all exit codes, or replace @ with the position in the pipe chain of the specific command you want. ps auxwww | grep banana | grep -v grep && echo ${PIPESTATUS[1]} type of thing
- joombaga 5y agoYou can also set -o pipefail. The first non-zero exit code is returned if there is one.