aboutsummaryrefslogtreecommitdiff
path: root/docs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'docs.sh')
-rwxr-xr-xdocs.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/docs.sh b/docs.sh
index fefb2b8..5e59a39 100755
--- a/docs.sh
+++ b/docs.sh
@@ -16,8 +16,15 @@ referencesFile="$HOME/.config/zathura/refs"
lines="$(wc -l "$referencesFile")"
if reference="$(sed '/^#/d' "$referencesFile" | sed '/^\s*$/d' | cut -d# -f1 |
dmenu -l "$lines" -p "Reference: ")"; then
+
line="$(grep "$reference" "$referencesFile" | sed q)"
file="$(echo "$line" | cut -d# -f2)"
page="$(echo "$line" | cut -d# -f3)"
- zathura -P "$page" "$file" &
+
+ if [ -n "$page" ]; then
+ zathura -P "$page" "$file" &
+ else
+ zathura "$file" &
+ fi
+
fi