diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-22 09:57:53 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-22 09:57:53 +0100 |
| commit | 5ac980dec555c543815d9defc3b7192354539b6c (patch) | |
| tree | 0df3bafdb245f580029ba54f86313fdb609b6de0 | |
| parent | bea38c1ce49b5e5e60e4e9f9261ec176ff59cd3c (diff) | |
| download | scripts-5ac980dec555c543815d9defc3b7192354539b6c.tar.gz scripts-5ac980dec555c543815d9defc3b7192354539b6c.zip | |
Fixed open-file, changed a bit open-stdin
| -rwxr-xr-x | open-file | 1 | ||||
| -rwxr-xr-x | open-stdin | 2 |
2 files changed, 2 insertions, 1 deletions
| @@ -20,6 +20,7 @@ xedit=${XEDITOR:-gedit} | |||
| 20 | 20 | ||
| 21 | openfile() { | 21 | openfile() { |
| 22 | f="$@" | 22 | f="$@" |
| 23 | localmime="$mimetype" | ||
| 23 | 24 | ||
| 24 | [ ! -f "$f" ] && echo "$f: bad argument" && exit 1 | 25 | [ ! -f "$f" ] && echo "$f: bad argument" && exit 1 |
| 25 | [ -z "$mimetype" ] && localmime="$(file --mime-type "$f" -bL)" | 26 | [ -z "$mimetype" ] && localmime="$(file --mime-type "$f" -bL)" |
| @@ -9,4 +9,4 @@ folder=${TMPDIR:-/tmp} | |||
| 9 | 9 | ||
| 10 | tempfile=$(mktemp -p "$folder") | 10 | tempfile=$(mktemp -p "$folder") |
| 11 | 11 | ||
| 12 | cat > "$tempfile" && open-file -s spawn -t "$1" "$tempfile" | 12 | cat > "$tempfile" && open-file $@ "$tempfile" |
