summaryrefslogtreecommitdiff
path: root/scripts/open-stdin
blob: a1e10b554c06517b5ef5a9cb5655e8a7ba63b8d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh

# Saves standard input in a temporary file and opens it (spawn)
# Usage: open-stdin 
# Requires: open-file (or set $OPENER to e.g. xdg-open)

folder=${TMPDIR:-/tmp}
open=${OPENER:-open-file}

tempfile=$(mktemp -p "$folder")

cat > "$tempfile" && $open $@ "$tempfile"

Generated with cgit - Back to sebastiano.tronto.net