diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-12-23 10:01:15 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-12-23 10:01:15 +0100 |
| commit | 7d3dc968b6183f51dc2594c80450372f0c8fb811 (patch) | |
| tree | 955b6be59884229125a63f070e16992dc5a79ca1 /open-stdin | |
| parent | 20bbe3418e71556ff2d14623cbbf047c0bd55855 (diff) | |
| download | scripts-7d3dc968b6183f51dc2594c80450372f0c8fb811.tar.gz scripts-7d3dc968b6183f51dc2594c80450372f0c8fb811.zip | |
Changes for new laptop
Diffstat (limited to 'open-stdin')
| -rwxr-xr-x | open-stdin | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -1,12 +1,12 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Saves standard input in a download folder and opens it (spawn) | 3 | # Saves standard input in a temporary file and opens it (spawn) |
| 4 | # Usage: open-stdin | 4 | # Usage: open-stdin |
| 5 | # Requires: open-file | 5 | # Requires: open-file (or set $OPENER to e.g. xdg-open) |
| 6 | 6 | ||
| 7 | #folder=$HOME/Downloads/open-stdin | ||
| 8 | folder=${TMPDIR:-/tmp} | 7 | folder=${TMPDIR:-/tmp} |
| 8 | open=${OPENER:-open-file} | ||
| 9 | 9 | ||
| 10 | tempfile=$(mktemp -p "$folder") | 10 | tempfile=$(mktemp -p "$folder") |
| 11 | 11 | ||
| 12 | cat > "$tempfile" && open-file $@ "$tempfile" | 12 | cat > "$tempfile" && $open $@ "$tempfile" |
