Skip to content

Instantly share code, notes, and snippets.

@hauleth
Last active November 10, 2017 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hauleth/8e1da4808e93e679cc34d920855b7c3c to your computer and use it in GitHub Desktop.
Save hauleth/8e1da4808e93e679cc34d920855b7c3c to your computer and use it in GitHub Desktop.
#!/bin/sh
set -eo pipefail
in="$(mktemp)"
out="$(mktemp)"
trap "rm '$in' '$out'" EXIT
cat /dev/stdin > "$in"
"$@" < "$in" 2>/dev/null > "$out" && cat "$out" || cat "$in"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment