Created
March 22, 2014 22:19
-
-
Save geoff-nixon/9715313 to your computer and use it in GitHub Desktop.
Pipe raw HTML to browser (OS X). Also takes file arguments.
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
:; I="$(basename $0)"; [ -z $BROWSER ] && open=open || open="$BROWSER" | |
[ $# -eq 0 ] && set -- -; [ "$1" = "-" ] && [ -t 0 ] && | |
echo "Usage: [ COMMAND | $I ] | [ $I < FILE ] | [ $I FILE ... ]" >&2 && exit | |
for what; do where="/tmp/$(od -N2 < /dev/urandom | openssl dgst -sha1).html" | |
cat "$what" > "$where" && $open "$where"; sleep 1 && rm -f "$where" & done | |
## Or, you might prefer what I use: | |
# cat "$what" > "$where" && qlmanage -p "$where" >/dev/null 2>&1; sleep 1 ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment