Created
January 9, 2020 11:23
-
-
Save rawiriblundell/22751e82476483a037926e0eb86fff5f to your computer and use it in GitHub Desktop.
A tiny function to silence commands and output their return code, useful for portability (e.g. where 'grep' might not have a '-q' arg on a classic unix)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_rc() { | |
"${@}" >/dev/null 2>&1 && return "${?}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment