From 060fa4cebaad9ad0c3c5321d618d1dd56dfdbcec Mon Sep 17 00:00:00 2001 From: emma Date: Mon, 21 Nov 2022 23:16:29 -0500 Subject: [PATCH] implemented error message for nonexistent key --- tomcat | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tomcat b/tomcat index 7d65ff5..9453ce0 100755 --- a/tomcat +++ b/tomcat @@ -2,6 +2,7 @@ set -e +argv0="$0" argv1="$1" argv2="$2" @@ -59,6 +60,9 @@ if test -n "$ARR"; then # change the line delineator to newlines for parsing and output the result printf "%s\n" "$VAL" | sed 's/ /\n/g' | head -n "$ARR" |\ tail -n 1 +elif ! test -n "$VAL"; then + printf "%s: %s: no such key or table\n" "$argv0" "$argv1" + exit 65 # sysexits(3) EX_DATAERR else printf "%s\n" "$VAL" fi