diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-07-01 10:40:01 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-07-01 10:40:01 +0200 |
commit | e7ebdcd1ed66f9833906fbf154607cdbd46fdae2 (patch) | |
tree | d857f3a5a219a038a77113d8d412c824b225e56d /bin/menuscripts/mpdf | |
parent | e0fab4836639db0c9b4719551aa24cc26850b358 (diff) | |
parent | b3e19b6a7c1ab3ea8fefc60352ace64a560b46cd (diff) |
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/menuscripts/mpdf')
-rwxr-xr-x | bin/menuscripts/mpdf | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/bin/menuscripts/mpdf b/bin/menuscripts/mpdf index d26c841..d67fdae 100755 --- a/bin/menuscripts/mpdf +++ b/bin/menuscripts/mpdf @@ -12,14 +12,11 @@ fi 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" | +choice="$(sed "s|^$HOME|\~| ; s|\([^/]\)[^/]*/|\1/|g" "$tmp" | awk '{printf "%s %s\n", NR ":", $0}' | $menucmd | - grep -oE "^[0-9]+:" | - cut -f1 -d:)" -if [ -z "$choice" ]; then - exit -fi + grep -o "^[0-9]\+:" | + cut -f 1 -d :)" +test -z "$choice" && exit 1 file="$(sed -n "${choice}p" "$tmp")" zathura "$file" & |