summaryrefslogtreecommitdiff
path: root/bin/guiscripts/dmpdf
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-03-12 15:09:31 +0100
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-03-12 15:09:31 +0100
commit31dbf42248b7517d15c6b9fb1e0fa92d9fb3964d (patch)
tree09530714f9c9075fd4ea1bad7697456f34ca67a8 /bin/guiscripts/dmpdf
parent14facbc4769699aae7588bcd3b3cb9aa4de81c6b (diff)
use variable for tmp file
Diffstat (limited to 'bin/guiscripts/dmpdf')
-rwxr-xr-xbin/guiscripts/dmpdf14
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/guiscripts/dmpdf b/bin/guiscripts/dmpdf
index 21f3ed0..2d51760 100755
--- a/bin/guiscripts/dmpdf
+++ b/bin/guiscripts/dmpdf
@@ -1,14 +1,14 @@
#!/bin/bash
-find ${1:-$HOME/docs $HOME/dl} 2> /dev/null | grep -E ".+\.pdf" | sort > /tmp/dmpdf
+tmp="/tmp/dmpdf"
+find ${1:-$HOME/docs $HOME/dl} 2> /dev/null | grep -E ".+\.pdf" | sort > "$tmp"
choice="$(\
- sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmpdf \
- | awk '{printf "%s %s\n", NR ":", $0}' \
- | dmenu -l 10 -g 1 -x -i \
- | grep -oE "^[0-9]+:" \
-)"
+ sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' "$tmp" |
+ awk '{printf "%s %s\n", NR ":", $0}' |
+ dmenu -p "pdf:" -l 10 -g 1 -x -i |
+ grep -oE "^[0-9]+:")"
if [ -z "$choice" ]; then
exit
fi
-file="$(sed -n "${choice::-1}p" /tmp/dmpdf)"
+file="$(sed -n "${choice::-1}p" "$tmp")"
zathura "$file" &