diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2021-11-03 21:03:25 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2021-11-03 21:03:25 +0100 |
commit | d61e9e943be59a9caddf35c21e4b2d0604d45ddc (patch) | |
tree | 63f92a6b76d6784a524f199b6e4f2e0151ab0b2e | |
parent | 8f70aa6798b1a3236d5ce884419446539d124e26 (diff) | |
download | scripts-d61e9e943be59a9caddf35c21e4b2d0604d45ddc.tar.gz scripts-d61e9e943be59a9caddf35c21e4b2d0604d45ddc.zip |
Comment support for docs.sh config file.
-rwxr-xr-x | docs.sh | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -8,11 +8,13 @@ # The syntax of the references file must be: # Name#Absolute path to pdf#Page number # The only character with any logic is #, used to separate fields +# Lines starting directly with # are comments +# Empty lines are ignored # Name can be anything and is just used for selection with dmenu referencesFile="$HOME/.config/zathura/refs" lines="$(wc -l "$referencesFile")" -if reference="$(cut -d# -f1 <"$referencesFile" | +if reference="$(sed '/^#/d' "$referencesFile" | sed '/^\s*$/d' | cut -d# -f1 | dmenu -c -bw 3 -i -l "$lines" -p "Reference: ")"; then line="$(grep "$reference" "$referencesFile" | sed q)" file="$(echo "$line" | cut -d# -f2)" |