implemented error message for nonexistent key

This commit is contained in:
Emma Tebibyte 2022-11-21 23:16:29 -05:00
parent 1d06d94058
commit 060fa4ceba

4
tomcat
View File

@ -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