Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
bbarnett
on July 9, 2021
|
parent
|
context
|
favorite
| on:
The Greatest Regex Trick Ever (2014)
In bash, you can get the rc of piped things, the var eludes me while walking..
dylan604
on July 9, 2021
|
next
[–]
${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
on July 9, 2021
|
prev
[–]
You can also set -o pipefail. The first non-zero exit code is returned if there is one.
Join us for
AI Startup School
this June 16-17 in San Francisco!
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: