Skip to content

Instantly share code, notes, and snippets.

@tdammers tdammers/view-with

Created Oct 2, 2018
Embed
What would you like to do?
#!/usr/bin/env bash
if [ "$2" ]
then EXTENSION=".$2"
else EXTENSION=""
fi
PID="$$"
TMPFILE="/tmp/$PID$EXTENSION"
cat >"$TMPFILE"
if [ "$3" == "detach" ]
then
"$1" "$TMPFILE" & disown
else
"$1" "$TMPFILE"
sleep 1
rm "$TMPFILE"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.