Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Read data from std in and show in a browser
#!/bin/bash
#
# Read data from std in and show in a browser.
#
# E.g. curl google.com | bcat
#
EXT=${1:-.html}
TMPFILE=`mktemp '/tmp/bcat.XXXXXXXX'`"$EXT" || exit 1
cat > $TMPFILE
/Applications/Safari.app/Contents/MacOS/Safari $TMPFILE 2> /dev/null
rm $TMPFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment