From 18be035dce765984da99db26da9d726f8479ce0e Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 20 Oct 2019 08:22:18 -0400 Subject: [PATCH] Fixed a bug that would cause the wrong note to be displayed when passed from the commandline. Tightened up the argument checker for note number. --- notestorm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notestorm b/notestorm index decf65e..72d3557 100755 --- a/notestorm +++ b/notestorm @@ -151,14 +151,14 @@ delete_note() { } display_note() { - if [[ "$1" =~ [0-9]+ ]]; then + if [[ "$1" =~ ^[0-9]*$ ]]; then mapfile -t notes < <(find "$xdgPath/notestorm/notes" -type f -iname '*.md') if [[ $1 -ge "${#notes[@]}" ]]; then gettext "The requested note could not be found. Try using -l to get a list." echo " ($1)" exit 1 fi - cat "${notes[1]}" + cat "${notes[$1]}" exit 0 fi if [[ "${1##*.}" == "gpg" ]]; then