KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Bash: I want to run a command and pipe the results through some filter, but if the command fails, I want to return the command's error value, not the boring return value of the filter: E.g.: if !(cool_command | output_filter); then handle_the_error; fi Or: set -e cool_command | output_filter In either case it's the return value of cool_command that I care about -- for the 'if' condition in the first case, or to exit the script in the second case. Is there some clean idiom for doing this?
Tags (comma-separated)
Save Edits
Cancel