diff options
Diffstat (limited to 'docs.sh')
-rwxr-xr-x | docs.sh | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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 |