From a7c57c3779c79fa40befda1e4e2e42bcbfa82337 Mon Sep 17 00:00:00 2001 From: Vera Lewis Date: Sun, 31 Mar 2024 02:17:00 -0500 Subject: [PATCH] vns_print now verifies the existence of the note to print --- vns | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/vns b/vns index 3b6c30e..158b51b 100644 --- a/vns +++ b/vns @@ -308,11 +308,17 @@ vns_print () { # print the given note to stdout # Verify $1 is bound - if [ "$#" -lt 1 ]; then vns_raise "Insufficient arguments" 11; fi - - # Decrypt the specified note - gpg2 --batch -d "$VNS_STORE/$1.gpg" - + if [ "$#" -lt 1 ]; then + vns_raise "Insufficient arguments" 11 + + # Verify $1 exists + elif ! [ -r "$VNS_STORE/$1.gpg" ]; then + vns_raise "Could not read $1" 12 + + else + # Decrypt the specified note + gpg2 --batch -d "$VNS_STORE/$1.gpg" + fi } vns_mv () {