From ec4123f4b362e66a502da415b684e61885448b50 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Fri, 1 Dec 2023 12:32:41 +0100 Subject: [PATCH] DB2 check method without output --- db23.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db23.sh b/db23.sh index 9b8204a..6df2ccc 100755 --- a/db23.sh +++ b/db23.sh @@ -14,7 +14,11 @@ DB2() { open|load) file="$1" cat "$file" || return 1 ;; - count|check|contains) key="$(STRING "$1")" val='' seq=0 + check|contains) key="$(STRING "$1")" val='' + val="${data##*${BR}${key} }" val="${val%%${BR}*}" + [ "$val" = '' ] && return 1 + ;; + count) key="$(STRING "$1")" val='' seq=0 val="${data##*${BR}${key} }" val="${val%%${BR}*}" [ "$val" = '' ] || val="${val} " while [ "$val" != '' ]; do -- 2.39.5