Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@haraldmartin
Forked from defunkt/browser
Created March 1, 2010 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haraldmartin/318893 to your computer and use it in GitHub Desktop.
Save haraldmartin/318893 to your computer and use it in GitHub Desktop.
#!/bin/sh -e
#
# Usage: browser
# pipe html to a browser
# e.g.
# $ echo "<h1>hi mom!</h1>" | browser
if [ -t 0 ]; then
cat <<usage
Usage: browser
pipe html to a browser
$ echo '<h1>hi mom!</h1>' | browser
$ ron -5 man/rip.5.ron | browser
usage
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