Skip to content

Instantly share code, notes, and snippets.

@HeinrichHartmann
Created September 23, 2016 10:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HeinrichHartmann/5ab1a4396e264f507e78333c210e9c1c to your computer and use it in GitHub Desktop.
Save HeinrichHartmann/5ab1a4396e264f507e78333c210e9c1c to your computer and use it in GitHub Desktop.
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