Skip to content

Instantly share code, notes, and snippets.

@ormaaj
Forked from anonymous/stdin
Last active August 29, 2015 14:13
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 ormaaj/0f7801aad6d1c7c153df to your computer and use it in GitHub Desktop.
Save ormaaj/0f7801aad6d1c7c153df to your computer and use it in GitHub Desktop.
_jshon() {
shopt -s lastpipe
typeset input status
{ tee /dev/fd/3 | jshon "$@" >&4; } 3>&1
input=$(</dev/fd/0)
((PIPESTATUS[0])) && printf %s "$input" >&2
return "${PIPESTATUS[0]}"
} 4>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment