-
-
Save larryebaum/f1dad7bdae3a8b40f405b518ad8e4420 to your computer and use it in GitHub Desktop.
pipe html to a browser
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
#!/bin/sh -e | |
# | |
# Usage: browser | |
# pipe html to a browser | |
# e.g. | |
# $ echo '<h1>hi mom!</h1>' | browser | |
# $ ron -5 man/rip.5.ron | browser | |
if [ -t 0 ]; then | |
if [ -n "$1" ]; then | |
open $1 | |
else | |
cat <<usage | |
Usage: browser | |
pipe html to a browser | |
$ echo '<h1>hi mom!</h1>' | browser | |
$ ron -5 man/rip.5.ron | browser | |
usage | |
fi | |
else | |
f="/tmp/browser.$RANDOM.html" | |
cat /dev/stdin > $f | |
open $f | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation:
brew install browser
Or, if you must:
Usage