#!/bin/sh -e
#
# stdin2ff - read from stdin, write to temp file, open temp file in browser, delete it
#
# ---
# see: https://overflow.ducks.party/exchange/unix/questions/24931/how-to-make-firefox-read-stdin#24939

tmpfile="$(mktemp "${TMPDIR:-/tmp}"/.XXXXXX.html)" || tmpfile=/tmp/$$.html
# tmpfile=$(mktemp).html
cat >"${tmpfile}"
# open -a Firefox "${tmpfile}"
browser "${tmpfile}"
trap 'rm -f "${tmpfile}"' EXIT
