Skip to content

Instantly share code, notes, and snippets.

@ormaaj
ormaaj / stdin
Last active August 29, 2015 14:13 — forked from anonymous/stdin
_jshon() {
shopt -s lastpipe
{ tee /dev/fd/3 | jshon "$@" >&4; } 3>&1 |
input=$(</dev/fd/0)
((PIPESTATUS)) || echo "$input"
} 4>&1
@ormaaj
ormaaj / stdin
Last active August 29, 2015 14:13 — forked from anonymous/stdin
_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
@ormaaj
ormaaj / gist:5927201
Last active December 19, 2015 08:39 — forked from anonymous/gist:5926435
modified for sw
#!/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 {