#!/bin/sh -e
#
# vipe - use `$EDITOR` to edit text in pipelines
#
# write all data to a temporary file, edit that file, then print it again
#
# ---
# source: https://movq.de/git/bin-pub/file/vipe.html

tmp=$(mktemp)
trap 'rm -f "$tmp"' 0

cat >"${tmp}"
${EDITOR:-vi} "${tmp}" </dev/tty >/dev/tty
cat "${tmp}"
