Created
September 23, 2016 10:10
-
-
Save HeinrichHartmann/5ab1a4396e264f507e78333c210e9c1c to your computer and use it in GitHub Desktop.
Read data from std in and show in a browser
This file contains hidden or 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 | |
# | |
# 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