From d61e9e943be59a9caddf35c21e4b2d0604d45ddc Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Wed, 3 Nov 2021 21:03:25 +0100 Subject: Comment support for docs.sh config file. --- docs.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs.sh') diff --git a/docs.sh b/docs.sh index 8780b5d..90a655d 100755 --- a/docs.sh +++ b/docs.sh @@ -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)" -- cgit v1.2.1