diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-02-15 16:31:56 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-02-15 16:47:43 +0100 |
commit | 3b2a78935fd6550521f719a10e5b0fceb1ddb350 (patch) | |
tree | 7c50801d6bb5b7abba3df6352ed43df454a4dbcb /bin/dmscripts/dmpdf |
Not really but, First commit!
Diffstat (limited to 'bin/dmscripts/dmpdf')
-rwxr-xr-x | bin/dmscripts/dmpdf | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bin/dmscripts/dmpdf b/bin/dmscripts/dmpdf new file mode 100755 index 0000000..6137e1a --- /dev/null +++ b/bin/dmscripts/dmpdf @@ -0,0 +1,21 @@ +#!/bin/bash +directory="${1:-$PWD}" +choice="$(\ + find "${directory}" \ + -type f \ + -iname "*.pdf" \ + -printf "%p\n" \ + | awk -F '/' '{print $(NF - 1) "/" $NF}' \ + | sort \ + | uniq \ + | dmenu -i -x -p "pdf:" -l 10 -g 2 \ + | awk -F '/' '{print $2}' \ +)" + +# find matching file +file="$(\ + find "$directory" -name "*$choice*" \ +)" + +[[ -f "$file" ]] || exit 1 +evince "$file" & |