Created
October 2, 2018 09:54
-
-
Save tdammers/f938f5be77fc5ddd19d02ff4eb24724c to your computer and use it in GitHub Desktop.
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
#!/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