View stdin
This file contains 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
_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 |
View stdin
This file contains 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
_jshon() { | |
shopt -s lastpipe | |
{ tee /dev/fd/3 | jshon "$@" >&4; } 3>&1 | | |
input=$(</dev/fd/0) | |
((PIPESTATUS)) || echo "$input" | |
} 4>&1 |
View gist:5927201
This file contains 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
#!/bin/bash | |
${BASH_VERSION+shopt -s extglob lastpipe} 2>/dev/null | |
# Full path to a file to store our date offset data. Will be overwritten. | |
datefile=./datefile | |
# Assign your vars or insert whatever code does so here. | |
user=foouser password=mypassword db=mydbname | |
function doit { |